Skip to content

Commit 245fffb

Browse files
committed
Misc
1 parent 109c079 commit 245fffb

File tree

7 files changed

+12
-5
lines changed

7 files changed

+12
-5
lines changed

extensions/ipynb/src/deserializers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ enum CellOutputMimeTypes {
9393
stdout = 'application/vnd.code.notebook.stdout'
9494
}
9595

96-
const textMimeTypes = ['text/plain', 'text/markdown', CellOutputMimeTypes.stderr, CellOutputMimeTypes.stdout];
96+
export const textMimeTypes = ['text/plain', 'text/markdown', 'text/latex', CellOutputMimeTypes.stderr, CellOutputMimeTypes.stdout];
9797

9898
function concatMultilineString(str: string | string[], trim?: boolean): string {
9999
const nonLineFeedWhiteSpaceTrim = /(^[\t\f\v\r ]+|[\t\f\v\r ]+$)/g;

extensions/ipynb/src/serializers.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { nbformat } from '@jupyterlab/coreutils';
77
import { NotebookCellData, NotebookCellKind, NotebookCellOutput } from 'vscode';
88
import { CellOutputMetadata } from './common';
9+
import { textMimeTypes } from './deserializers';
910

1011
const textDecoder = new TextDecoder();
1112

@@ -15,8 +16,6 @@ enum CellOutputMimeTypes {
1516
stdout = 'application/vnd.code.notebook.stdout'
1617
}
1718

18-
const textMimeTypes = ['text/plain', 'text/markdown', CellOutputMimeTypes.stderr, CellOutputMimeTypes.stdout];
19-
2019
export function createJupyterCellFromNotebookCell(
2120
vscCell: NotebookCellData
2221
): nbformat.IRawCell | nbformat.IMarkdownCell | nbformat.ICodeCell {

src/vs/base/common/mime.ts

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export namespace Mimes {
1515
export const binary = 'application/octet-stream';
1616
export const unknown = 'application/unknown';
1717
export const markdown = 'text/markdown';
18+
export const latex = 'text/latex';
1819
}
1920

2021
export interface ITextMimeAssociation {

src/vs/workbench/contrib/notebook/browser/view/output/transforms/richTransform.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class MdRendererContrib extends Disposable implements IOutputRendererContributio
217217
}
218218

219219
getMimetypes() {
220-
return [Mimes.markdown];
220+
return [Mimes.markdown, Mimes.latex];
221221
}
222222

223223
constructor(

src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ async function webviewPreloads(ctx: PreloadContext) {
11551155

11561156
await renderers.render(this, this.element);
11571157

1158-
if (this.mime === 'text/markdown') {
1158+
if (this.mime === 'text/markdown' || this.mime === 'text/latex') {
11591159
const root = this.element.shadowRoot;
11601160
if (root) {
11611161
if (!hasPostedRenderedMathTelemetry) {

src/vs/workbench/contrib/notebook/common/notebookCommon.ts

+3
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ export const NOTEBOOK_DISPLAY_ORDER = [
3737
'application/javascript',
3838
'text/html',
3939
'image/svg+xml',
40+
Mimes.latex,
4041
Mimes.markdown,
4142
'image/png',
4243
'image/jpeg',
4344
Mimes.text
4445
];
4546

4647
export const ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER = [
48+
Mimes.latex,
4749
Mimes.markdown,
4850
'application/json',
4951
Mimes.text,
@@ -567,6 +569,7 @@ const _mimeTypeInfo = new Map<string, MimeTypeInfo>([
567569
['image/git', { alwaysSecure: true, supportedByCore: true }],
568570
['image/svg+xml', { supportedByCore: true }],
569571
['application/json', { alwaysSecure: true, supportedByCore: true }],
572+
[Mimes.latex, { alwaysSecure: true, supportedByCore: true }],
570573
[Mimes.markdown, { alwaysSecure: true, supportedByCore: true }],
571574
[Mimes.text, { alwaysSecure: true, supportedByCore: true }],
572575
['text/html', { supportedByCore: true }],

src/vs/workbench/contrib/notebook/test/notebookCommon.test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ suite('NotebookCommon', () => {
2424
'application/javascript',
2525
'text/html',
2626
'image/svg+xml',
27+
Mimes.latex,
2728
Mimes.markdown,
2829
'image/png',
2930
'image/jpeg',
@@ -34,6 +35,7 @@ suite('NotebookCommon', () => {
3435
'application/javascript',
3536
'text/html',
3637
'image/svg+xml',
38+
Mimes.latex,
3739
Mimes.markdown,
3840
'image/png',
3941
'image/jpeg',
@@ -44,6 +46,7 @@ suite('NotebookCommon', () => {
4446
assert.deepStrictEqual(sortMimeTypes(
4547
[
4648
'application/json',
49+
Mimes.latex,
4750
Mimes.markdown,
4851
'application/javascript',
4952
'text/html',
@@ -57,6 +60,7 @@ suite('NotebookCommon', () => {
5760
'application/javascript',
5861
'text/html',
5962
'image/svg+xml',
63+
Mimes.latex,
6064
Mimes.markdown,
6165
'image/png',
6266
'image/jpeg',

0 commit comments

Comments
 (0)