Commit graph

47 commits

Author SHA1 Message Date
Matt Bierner afbec2027b
Fix markdown-it-katex error (#202393) 2024-01-12 18:46:08 -08:00
Matt Bierner 1a7ec6aea2
Fix code block in notebook markdown rendering (#201748)
Fixes #201731
2024-01-08 08:33:55 -08:00
Matt Bierner 25ac184fe7
Fix notebook markdown list rendering (#198696)
Fixes #197097
2023-11-20 18:23:14 +01:00
Peng Lyu 2cbf01b666
Revert "Notebook UI heading tweaks (#188117)" (#188335)
This reverts commit e055922046.
2023-07-20 08:02:39 +02:00
Christian Bromann e055922046
Notebook UI heading tweaks (#188117)
* Notebook UI heading tweaks

* align styles
2023-07-18 19:40:46 +02:00
Matt Bierner e4b323c098
Allow <source> tags in rendered markdown (#172063)
Fixes #171330
2023-01-23 21:07:25 +01:00
Matt Bierner 2a4fb40a6e
Align list of supported tags in rendered markdown (#161544)
This expands the list of html tags we allow in markdown. To get this list, I've copied the list of tags from `markdownDocumentRenderer` into `dom` after  reviewing them

For #134514, I've also added `video` to the list of allowed tags
2022-09-22 18:25:48 -07:00
Matt Bierner 07a5d2749f
Allow _ in notebook markdown links (#161437)
Fixes #160853
2022-09-21 14:23:47 -07:00
Matt Bierner 0103536a60
Apply editor-font-family to all code in notebooks (#157554)
Apply editor-font-family to all `code` in notebook

Fixes #146696

This matches what we do in the markdown preview
2022-08-08 20:59:16 +02:00
Matt Bierner cf145a83ac
Enable safe inline svg tags in trusted html (#156216)
Enable safe svg tags in trusted html

From cce00ac40d/src/tags.js (L124)
2022-07-25 16:32:10 -07:00
Matt Bierner b8420578fd
Add additional allowed tags in untrusted notebook markdown (#150228)
This adds some extra allowed tags when rendering markdown in notebooks. Additions are:

```
  "b",

    "br",

    "caption",

    "center",

    "col",

    "colgroup",

    "details",

    "em",

    "font",

    "i",

    "kbd",

    "sub",

    "summary",

    "sup",

    "table",

    "tbody",

    "tfoot",

    "thead",

    "td",

    "th",

    "tr",

    "tt",

    "u",

    "video"
```
2022-05-23 22:30:42 +00:00
Matt Bierner 0d55d50173
Expose outputItem in notebook markdown eve (#149870)
For #121256

This change adds the current `ouputItem` to the notebook markdown renderer's environment

Renders that extend our markdown renderer can use this to access output item metadata for example
2022-05-18 16:14:32 -07:00
Matt Bierner 04ecb1d42f
Normalize markdown links in notebooks (#148827)
Fixes #146352

This ensures we pass links in markdown cells through the same normalization function we use to assign headers ids
2022-05-05 18:33:38 +00:00
rebornix ab2a987919
fix #146750. 2022-04-04 14:19:15 -07:00
rebornix 07e840cb51
Support syntax highlighting in code blocks in markdown output 2022-02-16 15:18:54 -08:00
Matt Bierner 2b752cc239
Only remove margin on last child of preview
Fixes #142791
2022-02-11 16:27:02 -08:00
Matt Bierner 53c29fc51f
Use inherited font size for markdown codeblocks
Testing this out since it can look weird to have code blocks in a small font while the rest of markup is large
2021-11-09 16:14:04 -08:00
Matt Bierner a4ad395f23
Increase default markup font size
For #126294
2021-11-09 14:23:15 -08:00
Matt Bierner 8b7aa3c278
Use editor font for markdown codeblocks
For #136693
2021-11-08 14:11:59 -08:00
Matt Bierner 5e6d0e1cbb
Initial support for syntax highlighting md code blocks in notebooks
For #136693
2021-11-08 12:30:13 -08:00
Matt Bierner d1f2d0a729
Tweak markdown notebook header sizes
Fixes #105900
2021-11-05 15:57:30 -07:00
Matt Bierner 69ca0f29fd
Enable linkify in notebook markdown
Fixes #136545
2021-11-05 13:52:53 -07:00
Alex Dima a704a69394
Enforce that source code uses a small subset of Unicode 2021-11-03 23:34:41 +01:00
Lemmingh d3ceb35bec
Add source map for every possible element in the Markdown preview (#134799)
* Update markdown-it and type definitions

* Refresh the source map mechanism in `markdownEngine.ts`
2021-10-12 16:25:56 -07:00
Jim Griesmer 845af8a5c3
Enlarge small markdown text size - trivial change (#134550)
* Enlarge small markdown text size - trivial change

* Didn't intend to change h1 line height

* Simplify font-size story for h1, h2, h3 and p
2021-10-08 12:29:39 -07:00
Matt Bierner 28bc889cea
Use ActivationFunction 2021-08-30 13:54:39 -07:00
Matt Bierner 0ec3d48b70
Use @types/vscode-notebook-renderer 2021-08-30 13:54:39 -07:00
Matt Bierner e56fa01346
Switch to dompurify 2021-08-18 16:54:59 -07:00
Matt Bierner 068dcfbfc8
Allow images in md by default 2021-08-18 16:54:58 -07:00
Matt Bierner a6d26aa31c
Add insane for notebook markdown rendering 2021-08-18 15:09:23 -07:00
Matt Bierner 691e9cea33
Support clickable links between markdown cells
Fixes #103519
2021-08-13 14:17:10 -07:00
Matt Bierner bc14fe9e8d
Use templates for markdown styles
These styles shouldn't be added into the notebook itself, only into the shadow dom of the markdown cells
2021-06-09 15:17:21 -07:00
Matt Bierner 39dc60dec6
Move notebook empty markdown cell logic into markdown extension 2021-06-08 13:50:10 -07:00
Matt Bierner 30ed48f190
Move notebook markdown styles and shadow root to markdown-it extension 2021-06-08 13:08:44 -07:00
Matt Bierner fd430418a0
Refine CellInfo type (#125351)
For #125269

- Rename `CellInfo` - >`OutputItem` (only internally, we also need to update the published types)
- Move `id` into `OutputItem`
- Move `element` out of `OutputItem`
- Rename `renderCell` to `renderOutputItem`
- Rename `destoryCell` to `disposeOutputItem` (`dispose` is  the term we generally use in our APIs)
2021-06-03 13:01:02 -07:00
Johannes Rieken 9ef57b5c21
remove NotebookCellOutputItem#value, https://github.com/microsoft/vscode/issues/123884 2021-05-27 14:55:25 +02:00
Johannes Rieken effac5be7f
drop as-prefix for ICreateCellInfo 2021-05-21 17:30:29 +02:00
Johannes Rieken 494e827e35
expose output item bytes to renderers and provide util functions: asText, asJSON, asBytes, asBlob, fyi @connor4312, https://github.com/microsoft/vscode/issues/123884 2021-05-21 12:36:10 +02:00
Matt Bierner 66fa5c41b3
First cut at unifying notebook renderers apis
This implements the api described in #123540. Major points:

- Instead of having the `markdown-it` renderer pull it its dependencies, instead the dependencies can call `getRenderer` to import the object returned by the `markdown-it` renderer

- We try to detect if a renderer is using the old or new api. Old renderers are still run as globals while new ones are loaded with `import`

- I have only hooked up the new API for markdown renderers so far
2021-05-12 19:32:57 -07:00
Matt Bierner 13d81db250
Don't insert link element into the markdown cell preview body
Fixes #123012
2021-05-05 14:35:46 -07:00
Matt Bierner 7770708545
Reapply markup renderers change
Rewriting how we do replacements in the webviewPreloads function to hopefully handle optimization better
2021-04-28 10:44:25 -07:00
Matt Bierner fe7c5aba01
Revert "Better notebook markup renderer api (#121882)"
This reverts commit 4cb27d2ec7.
2021-04-26 19:43:16 -07:00
Matt Bierner 4cb27d2ec7
Better notebook markup renderer api (#121882)
* Better notebook markup renderer api

For #121256

- Use js modules for notebook output renderers
- Rename apis from `markdown` to `markup`
- Use imports and exports for apis instead of globals for apis
- Use esbuild instead of webpack so we can emit js modules
- Clearly split top level markup renderes from renderers that extend other renderers

* Use constant instead of comment for replacement
2021-04-26 16:30:34 -07:00
Matt Bierner d4412e708a
Render markdown preview cells inside a shadow dom (#120137)
* Render markdown preview cells inside a shadow dom

Fixes #119971

This moves all markdown previews into shadow doms. This lets us prevent styles from outside the preview leak into the preview, and also prevents styles from the preview leak out into the rest of the notebook

* Use composedPath for handling events in webviews

This lets us handle clicks triggered inside of a shadow dom
2021-03-30 14:17:15 -07:00
Matt Bierner 9b4f1aff5d Enable inline html tags in notebook markdown
Fixes #113351
2021-02-11 17:21:30 -08:00
Matt Bierner 6dd156d04b Support drag and drop copy for markdown cells
For #116393

Also removes some logging and improves drag/drop responsiveness
2021-02-10 17:37:51 -08:00
Matt Bierner 35f855796b
Add support for markdown notebook renderers (#115191)
* Use shared webpack version instead of installing locally for simple-browser

* Use npm for building markdown preview

* render markdown in webview.

* update markdown preview height and offset

* Add basic custom notebook renderer point

* update css

* style update.

* update markdown header padding left

* Add example of loading katex to extend the markdown-it renderer

* Rename global to make clear it only applies to markdown-in

* hide/remove markdown preview

* Add wait for initial markdown preview rendering before showing notebook

* Add double click to switch to editing mode

* Fix markdown cells not getting updated after editing

* style polish

* notebook.experimental.useMarkdownRenderer

* switch render strategy.

* Adding very intial drag drop support for notebook markdown cells

* Implement drag/drop stubs for test classes

* Revert unrelated file changes

* Move markdown notebook math to own extension

* Add missing imports

Co-authored-by: rebornix <penn.lv@gmail.com>
2021-02-10 16:41:53 -08:00