mirror of https://github.com/microsoft/vscode.git
Merge pull request #133464 from DonJayamanne/textLatex
This commit is contained in:
commit
cb70ab5526
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -47,7 +47,8 @@
|
|||
"displayName": "Markdown it renderer",
|
||||
"entrypoint": "./notebook-out/index.js",
|
||||
"mimeTypes": [
|
||||
"text/markdown"
|
||||
"text/markdown",
|
||||
"text/latex"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -217,7 +217,7 @@ class MdRendererContrib extends Disposable implements IOutputRendererContributio
|
|||
}
|
||||
|
||||
getMimetypes() {
|
||||
return [Mimes.markdown];
|
||||
return [Mimes.markdown, Mimes.latex];
|
||||
}
|
||||
|
||||
constructor(
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 }],
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue