Commit Graph

88 Commits

Author SHA1 Message Date
Matt Bierner
b9c18c3652 Align markdown preview slugifier with markdown LS's slugifier
For #280520
2025-12-10 11:44:05 -08:00
Matt Bierner
360c9fd134 Add lint rule for as any and bulk ignore all existing breaks
For #269213

This adds a new eslint rule for `as any` and `<any>({... })`. We'd like to remove almost all of these, however right now the first goal is to prevent them in new code. That's why with this first PR I simply add `eslint-disable` comments for all breaks

Trying to get this change in soon after branching off for release to hopefully minimize disruption during debt week work
2025-10-02 23:38:33 -07:00
Matt Bierner
73e6d6a0a2 Enable a few more stylistic eslint options for my extensions 2025-08-14 10:42:20 -07:00
notoriousmango
c4f757d3ce verbose to trace 2025-02-20 18:42:41 +09:00
Johannes
e6f315d2fc eng - use esModuleInterop for extensions 2024-10-01 21:57:30 +02:00
Matt Bierner
0cba3e61b8 Align rendered header id generation with markdown language service (#221742)
Fixes #220064
2024-07-15 12:17:10 -07:00
aaronchucarroll
a35380d6f0 Adds support for Github-style fenced math blocks in markdown editor and preview (#213750)
* added support for markdown fenced math blocks

* original markdownEngine.ts

* Add fenced math block rendering to markdown-math

* Update dependencies

* custom parser for fenced math blocks

* custom parser for fenced math blocks

* reverted changes to extension.ts

* reverted all changes from prior implementations

* proper fence grammar implementation for math

---------

Co-authored-by: Matt Bierner <matb@microsoft.com>
2024-07-12 04:51:37 +00:00
Matt Bierner
56ad6311c8 Pick up latest Markdown language service (#211391)
Fixes #211389
2024-04-25 13:48:44 -07:00
Matt Bierner
d81d32b940 Re-render markdown preview when linkify setting changes (#200599) 2024-01-11 17:23:13 -08:00
Matt Bierner
8f32885359 Use markdown engine to enable/disable smart paste (#202192)
Fixes #188863
Fixes #188958
Fixes #188868

This is more reliable than using the regular expressions. However the regular expressions are still needed for inline elements
2024-01-10 14:32:58 -08:00
Matt Bierner
8943ea4790 Fix markdown code block styling (#198351)
Fixes #198183

Remove extra background and also removes the extra divs inside of the code blocks as these were causing issues with styling (extra padding)
2023-11-15 21:03:04 +01:00
Matt Bierner
19f9f605a9 Correctly reload markdown preview on md contribution change (#188218)
Fixes #184295
2023-07-19 01:47:31 +02:00
Masaki Mori
1a79e7eb63 Fix #173735 (#174149)
* Fix #173735

* Fix #173735
2023-02-20 16:50:48 +00:00
Arthur
934e0ee5d8 Fix #170706 (#172842) 2023-02-01 00:34:02 +00:00
Marina Miyaoka
aa37e17423 Do not preprocess Unicode newlines in Markdown preview (#166026)
Revert LS PS preprocessing in Markdown preview
2022-11-10 19:46:43 +00:00
Matt Bierner
33867c55f3 Adopt prefix private with _ in markdown extension (#165088) 2022-10-31 14:22:39 -07:00
Matt Bierner
2d27f8db6a Use MD LS for resolving all document links (#160238)
* Use MD LS for resolving all document links

This switches the markdown extension to use the markdown language service when resolving the link. This lets us delete a lot of code that was duplicated between the extension and the LS

* Pick up new ls version
2022-09-07 20:55:14 -07:00
Matt Bierner
b012216211 Fix markdown images having duplicate ids (#157177)
Fixes #153144
2022-08-05 06:31:42 +02:00
Matt Bierner
07144d22c4 Rename types in the markdown extension (#152905)
Renames in the markdown extension

This renames some types and splits up some files as part of an exploration towards a proper LSP. Changes:

- `SkinnyTextDocument` -> `ITextDocument`
- Moved `ITextDocument` to own file
- `MdWorkspaceContents` -> `IMdWorkspace`
2022-06-22 14:12:48 -07:00
Matt Bierner
c84655d123 Reduce recomputation of state in markdown extension (#152804)
* Reduce recomputation of state in markdown extension

- Use `getForDocument` more often to avoid refetching documents
- Debounce `MdTableOfContentsWatcher`. We don't want this to trigger on every keystroke :)

* Cache LinkDefinitionSet

* Add test file change

* Fix toc watcher for tests
2022-06-21 16:25:10 -07:00
Matt Bierner
fa53aa6fec Cleanup pass for md extension (#152760)
Clean up names in md extension
2022-06-21 15:36:32 -04:00
Matt Bierner
2249b171f4 Reduce number of times MD docs are re-tokenized (#152674)
This change reduces the number of times we retokenize a markdown file by doing the following:

- Use `MdTableOfContentsProvider` in more places
- Introduce a `IMarkdownParser` interface that lets us drop in a caching version of the tokenizer
2022-06-21 08:43:01 +02:00
Matt Bierner
623f55f437 Refactor markdown language features (#152402)
(sorry for the size of this PR)

This change cleans up the markdown language features by making the following changes:

- Use `registerXSupport` public functions to register these
- Expose the slugifier the `MarkdownEngine` uses. You never want to use a different one if you already have a markdown engine
- Sort of clean up names. I'd introduced a bunch of confusing names while iterating in this space. What I'm working towards:

    - `Computer` — Stateless thing that computer data
    - `Provider` — Potentially stateful thing that provides data (which may be cached)
    - `VsCodeProvider` — The actual implementation of the various vscode language features (which should only be used by VS Code and in tests, not shared with other features)
- Introduce `MdLinkProvider` to avoid recomputing links for a given document. Also use this to hide more internals of link computation
2022-06-17 10:25:52 +02:00
Matt Bierner
3ce5c78cb9 Extract workspaceContents to own file 2022-03-29 18:19:49 -07:00
Matt Bierner
22fb4e9de8 Better align language provider names and export styles
- Use named exports
- use `Md*` for providers
2022-03-29 13:35:48 -07:00
Matt Bierner
4949f13d13 Organize imports 2022-03-29 13:25:40 -07:00
Matt Bierner
d49fc3ca8d Move files to better folders and add better name 2022-03-29 13:25:38 -07:00
Matt Bierner
c8c6224c84 Remove unused hash functions 2022-03-29 13:25:37 -07:00
Matt Bierner
78e1b3cca8 Bump highlight JS version 2022-03-08 16:27:42 -08:00
Mohammad Sadegh Salimi
2a0d371ca3 Adding support for RTL languages for readme markdown preview. (#139644)
* [markdown preview] dir "auto" added to the markdown-body class.

* fix markdown preview for RTL languages
2022-01-05 14:14:32 -08:00
Hans
3abcabd4e8 fix generates different html content for the same markdown (#138935)
fix generates different html content for the same markdown when get the cached token
2021-12-13 16:55:54 -08:00
Matt Bierner
7d46b77c31 Disable fuzzy links in md preview
Fixes #136198
2021-11-01 17:41:40 -07: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
Matt Bierner
277f6ef132 Log errors when loading markdown-it plugins 2021-09-08 15:12:46 -07:00
Matt Bierner
134c345351 Try adding browser specific tsconfig
Trying to add this to catch dependencies we take on node types
2021-07-22 17:00:17 -07:00
Matt Bierner
a71ebc98ff Avoid warning when acessing md setting 2021-07-07 16:58:04 -07:00
Matt Bierner
0a57fd87b1 Enable math in markdown preview
Fixes #124783
2021-06-08 09:58:54 -07:00
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