This commit is contained in:
Don Jayamanne 2021-09-16 15:58:59 -07:00
parent 109c0790d2
commit 245fffbce1
7 changed files with 12 additions and 5 deletions

View file

@ -93,7 +93,7 @@ enum CellOutputMimeTypes {
stdout = 'application/vnd.code.notebook.stdout'
}
const textMimeTypes = ['text/plain', 'text/markdown', CellOutputMimeTypes.stderr, CellOutputMimeTypes.stdout];
export const textMimeTypes = ['text/plain', 'text/markdown', 'text/latex', CellOutputMimeTypes.stderr, CellOutputMimeTypes.stdout];
function concatMultilineString(str: string | string[], trim?: boolean): string {
const nonLineFeedWhiteSpaceTrim = /(^[\t\f\v\r ]+|[\t\f\v\r ]+$)/g;

View file

@ -6,6 +6,7 @@
import { nbformat } from '@jupyterlab/coreutils';
import { NotebookCellData, NotebookCellKind, NotebookCellOutput } from 'vscode';
import { CellOutputMetadata } from './common';
import { textMimeTypes } from './deserializers';
const textDecoder = new TextDecoder();
@ -15,8 +16,6 @@ enum CellOutputMimeTypes {
stdout = 'application/vnd.code.notebook.stdout'
}
const textMimeTypes = ['text/plain', 'text/markdown', CellOutputMimeTypes.stderr, CellOutputMimeTypes.stdout];
export function createJupyterCellFromNotebookCell(
vscCell: NotebookCellData
): nbformat.IRawCell | nbformat.IMarkdownCell | nbformat.ICodeCell {

View file

@ -15,6 +15,7 @@ export namespace Mimes {
export const binary = 'application/octet-stream';
export const unknown = 'application/unknown';
export const markdown = 'text/markdown';
export const latex = 'text/latex';
}
export interface ITextMimeAssociation {

View file

@ -217,7 +217,7 @@ class MdRendererContrib extends Disposable implements IOutputRendererContributio
}
getMimetypes() {
return [Mimes.markdown];
return [Mimes.markdown, Mimes.latex];
}
constructor(

View file

@ -1155,7 +1155,7 @@ async function webviewPreloads(ctx: PreloadContext) {
await renderers.render(this, this.element);
if (this.mime === 'text/markdown') {
if (this.mime === 'text/markdown' || this.mime === 'text/latex') {
const root = this.element.shadowRoot;
if (root) {
if (!hasPostedRenderedMathTelemetry) {

View file

@ -37,6 +37,7 @@ export const NOTEBOOK_DISPLAY_ORDER = [
'application/javascript',
'text/html',
'image/svg+xml',
Mimes.latex,
Mimes.markdown,
'image/png',
'image/jpeg',
@ -44,6 +45,7 @@ export const NOTEBOOK_DISPLAY_ORDER = [
];
export const ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER = [
Mimes.latex,
Mimes.markdown,
'application/json',
Mimes.text,
@ -567,6 +569,7 @@ const _mimeTypeInfo = new Map<string, MimeTypeInfo>([
['image/git', { alwaysSecure: true, supportedByCore: true }],
['image/svg+xml', { supportedByCore: true }],
['application/json', { alwaysSecure: true, supportedByCore: true }],
[Mimes.latex, { alwaysSecure: true, supportedByCore: true }],
[Mimes.markdown, { alwaysSecure: true, supportedByCore: true }],
[Mimes.text, { alwaysSecure: true, supportedByCore: true }],
['text/html', { supportedByCore: true }],

View file

@ -24,6 +24,7 @@ suite('NotebookCommon', () => {
'application/javascript',
'text/html',
'image/svg+xml',
Mimes.latex,
Mimes.markdown,
'image/png',
'image/jpeg',
@ -34,6 +35,7 @@ suite('NotebookCommon', () => {
'application/javascript',
'text/html',
'image/svg+xml',
Mimes.latex,
Mimes.markdown,
'image/png',
'image/jpeg',
@ -44,6 +46,7 @@ suite('NotebookCommon', () => {
assert.deepStrictEqual(sortMimeTypes(
[
'application/json',
Mimes.latex,
Mimes.markdown,
'application/javascript',
'text/html',
@ -57,6 +60,7 @@ suite('NotebookCommon', () => {
'application/javascript',
'text/html',
'image/svg+xml',
Mimes.latex,
Mimes.markdown,
'image/png',
'image/jpeg',