Commit Graph

51 Commits

Author SHA1 Message Date
Matt Bierner 77ff6eb03b Add image specific link normalizer (#124400) 2021-05-21 14:42:50 -07:00
Matt Bierner e9b8c12915 Add types 2021-05-21 14:36:19 -07:00
Matt Bierner 97bbacd808 Remove extra call to with 2021-05-21 12:16:49 -07:00
Matt Bierner 79dea51e79 Rewrite webview urls to be more url-ish
## Problem

Webview uris currently have the form:

```
https://uuid.vscode-webview.net/vscode-resource/scheme/authority/path...
```

We have this syntax because we need to be able to recover the original scheme and authority of the resource in order to load it from disk

However this syntax means that absolute urls don't behave as you'd expect. For example, if you have a webview that sets a `<base>` to a document in the workspace, an absolute url `/abs/path.png` ends up being resolved to:

```
https://uuid.vscode-webview.net/abs/path.png
```

This drops the original scheme and authority, which prevents us from loading the resource

## Fix
With this change, I've moved the original scheme and authority into the authority of the webview uri instead of the path:

```
https://scheme+authority.vscode-resource.uuid.vscode-webview.net/path...
```

With this change, absolute paths should correctly be resolved
2021-05-21 09:28:43 -07:00
William Desgardin 30ccdf6b6c feat: add typographer option for markdown preview (#119641)
Co-authored-by: Matt Bierner <matb@microsoft.com>
2021-03-29 14:18:59 -07:00
Manuel Thalmann cdd7066f00 Allow Markdown-Rendering Without Providing an Env-Parameter (#117041)
* Add a rule for initializing the image-stabilizer

* Only use `containingImages` if the variable exists
2021-02-22 14:02:36 -08:00
Henning Dieterichs 1f8643ef76 Refresh Images In Markdown Preview On Change (#114083)
* Refresh Images In Markdown Preview On Change (implements #65258).

* Fixes tests.

* Implements etags.

* Adds tests for urlToUri.

* Updates doc comment.
2021-01-19 18:01:21 -08:00
Jean Pierre 7f4d67c94c Fix #110812 (#114553) 2021-01-19 14:21:02 -08:00
Jean Pierre f732547a3d Fixes #103076 (#103578) 2020-07-29 15:31:50 -07:00
Matt Bierner 1275b918be Use joinPath in a few more places 2020-06-10 16:44:10 -07:00
Matt Bierner b42086b6eb Enable markdown language features for web/serverless 2020-06-09 15:32:18 -07:00
Ilia Pozdnyakov f3a31a4eeb fix uri fragment slugification #94508 (#94655) 2020-04-09 14:21:18 -07:00
Matt Bierner 97855786a0 Fix absolute paths in markdown preview on windows
Fixes #84728

We should use `.fsPath` for both parts of the uri in this case.
2019-12-02 19:45:44 -08:00
Matt Bierner 78559bf9e6 Normalize vscode links in markdown files to target current vscode version
Fixes #71622

This allows you to use generic `vscode` links inside the markdown preview and still have them work if the preview is viewed in insiders
2019-10-23 20:27:52 -07:00
Matt Bierner 8e944be15c Support jsonc for code block type with highlightjs 2019-10-04 17:57:33 -07:00
Matt Bierner 36aa903d5a Rewrite how we handle links in the md preview
Try to simplify how we resolve links:

- Move most logic out of the preview itself.
- Simplify the amount of rewriting we do in the markdown engine
2019-10-04 17:57:33 -07:00
Matt Bierner e44d9a2888 Rename parameter 2019-08-20 11:28:31 -07:00
Matt Bierner 7c3aeb10a2 Merge pull request #77151 from connor4312/feat/markdown-render-command
feat(markdown): add render command (fixes #75612)
2019-08-20 11:23:47 -07:00
Matt Bierner b9b5692e27 Support using csharp in markdown preview to identify c# code blocks 2019-08-19 09:18:22 -07:00
Connor Peet 3c42f56552 fixup! render a string as well 2019-07-11 11:24:28 -07:00
Matt Bierner 9e7bb2c881 Support image/* data uris in markdown preview
Fixes #76080
2019-07-01 15:57:35 -07:00
Vitaliy Mazurenko e40d72b1b5 re-rendering Markdown preview when updated extra configurations provided by extension 2019-04-01 10:52:23 +03:00
Matt Bierner 038e8d3904 Make markdown extension points dynamic
For #67574

Blocked by #67958
2019-02-05 17:45:11 -08:00
Matt Bierner 476d7fe0ab Refactor markdown contributions
Reducing code duplication and reducing state
2019-02-05 16:56:45 -08:00
Matt Bierner c79a8bf7eb Remove stray log
:)
2019-02-01 14:45:26 -08:00
Matt Bierner 7f1745027b Re-use options from markdown engine instead of creating new options object
Fixes https://github.com/mjbvz/vscode-markdown-mermaid/issues/26
2019-01-25 11:48:25 -08:00
Matt Bierner 59ce7f3b28 Fix markdown preview code highlighting
Fixes #66772
2019-01-21 14:09:30 -08:00
Matt Bierner 344f4fa361 Make sure we update the markdown document on config changes 2019-01-09 19:32:53 -08:00
Matt Bierner 758280cc47 Extract TokenCache 2019-01-09 19:27:41 -08:00
Matt Bierner 5496ba7617 Prevent possible race while initilizing markdown engine 2019-01-09 19:18:23 -08:00
Matt Bierner 1bbc0e3b4d Deprecate the previewFrontMatter setting
Switch to always hiding the frontmatter and then allowing markdown-it plugins to render it properly if they wish. `previewFrontMatter: "show"` is also not very useful since it usually results in a jumble of text at the top of the file

This is required with the new performance work to avoid re-tokenizing the document  multiple times during rendering
2019-01-09 19:05:55 -08:00
Matt Bierner e325cce9bc Fixing markdown unit tests 2019-01-09 18:15:34 -08:00
pkoushik a6b761b033 fix-65575 Updated tokenize method - Returns cached token if exists or newly created token and cache it 2019-01-08 15:22:29 +05:30
pkoushik eabf436c07 fix-65575 tokenize method cache update bug fixed 2019-01-04 20:13:27 +05:30
pkoushik 661d191638 fix-65575 tokenize method added 2019-01-04 20:07:21 +05:30
pkoushik 1ef045875d fix-65575 Added CachedToken and implementation to use it 2019-01-03 11:56:11 +05:30
Matt Bierner 7086fb76ec Take document as parameter instead document components 2019-01-02 11:56:39 -08:00
Prabhanjan S Koushik e05aa178d6 Fix 63749 - Markdown, U+2028, and "Go to Symbol in File..." (#63936)
* fix-63749 - Added UNICODE_NEWLINE_REGEX

* fix-63749 - Removed .skip for the test method

* fix-63749 Moved Replace to parse
2018-11-29 09:09:36 -08:00
Sankt Petersbug f2653c04cb Fix Markdown Preview incorrectly encodes a link (#61530)
For known external scheme, the customized normalizeLink method use vscode.Uri to parse and create
the string representation of the link before caling the original normalizeLink method.
The toString method of vscode.Uri encodes the result by default, and this is unecessary since encoding
is handled by the original normalizeLink method.

Calls toString method with skipEncoding option.

Resolves: #60525
2018-10-22 15:41:22 -07:00
Ahmed Atito 6944a221c3 🐛 - Support C# in markdown preview code block syntax highlighting. (#61291) 2018-10-19 15:13:44 -07:00
Matt Bierner 9e017425b3 Replace markdown-named-headers with custom version
Fixes #47537

Use our own version of markdown named headers. This fixes some bugs around handling duplicate headers
2018-10-08 16:04:47 -07:00
Matt Bierner f87369e1af Treat json5 as json in the markdown preview 2018-10-05 13:06:37 -07:00
Matt Bierner 388a62fe12 Fix anchor links in markdown preview 2018-09-21 15:08:41 -07:00
SteVen Batten f8f4d3af30 improve markdown preview scroll sync (#58852)
* improve markdown preview scroll sync
2018-09-18 15:08:37 -07:00
Matt Bierner 4096b5d68e Avoid uri parse warnings for markdown uris
Fixes #58566

We only support local file links or a small set of normal schemes, like `http` and `mailto`. Use this to avoid calling `Uri.parse` with scheme-less paths such as `Uri.parse('/images/cat.gif')`
2018-09-13 15:43:47 -07:00
Matt Bierner 5eab03cf75 Fix folding code blocks / lists with front matter 2018-09-07 11:36:38 -07:00
Matt Bierner 1a9f7c85b8 Fix content after fenced code block being treated as code
Fixes #52509
2018-06-20 14:15:34 -07:00
Matt Bierner 7a24ced69f Make sure fenced code blocks properly get line numbers assigned
Fixes #51095
2018-06-04 10:16:58 -07:00
Matt Bierner feeefd1037 Inject slugifier into markdown engine 2018-05-25 11:57:01 -07:00
Matt Bierner 176a27a53b Start encapsulating slugifier 2018-05-24 08:05:52 -07:00