57 Commits

Author SHA1 Message Date
Matt Bierner
598304ba4d Merge pull request #269665 from mjbvz/dev/mjbvz/delicious-sloth
Add lint rule for `as any` and bulk ignore all existing breaks
2025-10-03 01:31:51 -07:00
Copilot
3a1b1ed83c Disable double-click to reveal source for .copilotmd files in markdown preview (#267517)
* Initial plan

* Disable double-click behavior for .copilotmd files in markdown preview

Co-authored-by: joaomoreno <22350+joaomoreno@users.noreply.github.com>

* Update extensions/markdown-language-features/preview-src/index.ts

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: joaomoreno <22350+joaomoreno@users.noreply.github.com>
Co-authored-by: João Moreno <joaomoreno@users.noreply.github.com>
2025-10-03 08:27:59 +00: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
Matt Bierner
42c4a17dd9 Merge pull request #240508 from notoriousmango/copy-image-handle-error
fix: use the copy command for images with CORS errors in the markdown preview
2025-03-25 13:35:14 -07:00
Matt Bierner
23812e0d8f Make sure scripts in md preview are properly evaluated
Fixes #243454

This restores the previous behavior. If the default security settings are used, scripts will still block blocked by the CSP. If you fully disable the security settings, then we'll try to run them
2025-03-17 11:45:49 -07:00
Seong Min Park
de60000148 Merge branch 'main' into copy-image-handle-error 2025-03-16 16:04:34 +09:00
Matt Bierner
0a66642a04 Don't duplicate body in md preview
Fixes #243340
2025-03-12 09:07:34 -07:00
notoriousmango
0928609c9b use selection to copy from web view 2025-02-12 19:09:31 +09:00
Matt Bierner
d70e0e2fe0 Merge pull request #236406 from mjbvz/confidential-trout
Small cleanup follow up on #236145
2024-12-17 12:22:16 -08:00
Matt Bierner
a47b13ebc2 Small cleanup follow up on #236145
- Don't send content as json
- Reuse existing load helper
2024-12-17 11:59:05 -08:00
Matt Bierner
4559089128 Merge pull request #234649 from notoriousmango/feat-open-image
Add 'open image' context in markdown preview
2024-12-17 11:55:25 -08:00
Parasaran
ca72122751 fix 235221: Encode and decode markdown content to escape illegal chars 2024-12-17 23:32:42 +05:30
Parasaran
da1d8b9c8e fix 235221: Passing the markdown content to the webview via meta tag and purifying it before use 2024-12-17 22:57:12 +05:30
notoriousmango
f7c3b1b474 use openDocumentLink 2024-12-15 00:11:54 +09:00
notoriousmango
0b243279cc open image 2024-11-26 19:53:31 +09:00
Gianluca Cappai
59f6431095 Fix open html anchor link in markdown preview (#228633)
use node.getAttribute instead of node.href

Co-authored-by: Gianluca Cappai <gcappai.dev@@gmail.com>
Co-authored-by: Matt Bierner <matb@microsoft.com>
2024-09-18 14:37:55 -07:00
Matt Bierner
5ee455116f Add codeql comments and small fix (#185931) 2023-06-23 02:40:39 +02:00
MeghanKulkarni
67cc0965b3 allow images in markdown preview editor to be copied (#184432)
* allow images in markdown preview editor to be copied

* resolved feedback

* added findPreview method

* removed copy image command from showPreview

* clean up

---------

Co-authored-by: Meghan Kulkarni <t-mekulkarni@microsoft.com>
2023-06-07 18:08:22 +00:00
Matt Bierner
87a6bda310 Fix opening encoded markdown fragment in preview (#178465)
Fixes #178340
2023-03-28 08:59:30 +02:00
Matt Bierner
1379bf3f15 Fix markdown webview state updates (#178153)
Fixes #164071

Also fixes the webview not scrolling when the resources changes
2023-03-23 17:51:09 +00:00
Matt Bierner
3ca5284e44 Clean up markdown preview messaging (#176458)
- Add properties directly to message
- Add `ImageInfo` type
- Don't use state to pass around imageInfo
2023-03-07 17:28:13 -08:00
Matt Bierner
6a44101bb1 Type markdown preview webview message (#176444)
Simply types messages. Will clean up types in next pass
2023-03-07 14:23:17 -08:00
Matt Bierner
83c4e0f5c4 Reset markdown scroll progress on resource change (#176437)
Reset scroll progress on resource change

Fixes #164071
2023-03-07 23:12:46 +01:00
Matt Bierner
d0ad7c09bb Fix details blocks being auto closed on markdown preview changes (#176330)
Fixes #175353
2023-03-07 02:36:38 +01:00
Matt Bierner
ac88f33e2c Revert "Fix: New md file scrolls to Top. (#164999)" (#168224)
This reverts commit 54543cf5bf.
2022-12-06 22:50:30 +01:00
Debayan Ganguly
54543cf5bf Fix: New md file scrolls to Top. (#164999)
Fixes #164071.
2022-11-09 13:48:39 -08:00
Matt Bierner
f4bf1f30a2 Skip ul and ol when highlighting selected markdown element (#161139)
Fixes #155552

For lists, the outer ul/ol always has the same source line as the first element in the list. We should prefer using the first element in the list when highlighting the active line

This also fixes a bug where scroll sync would stop working if you added lines to the doc. This was caused by `lineCount` getting out of sync as the document is being updated. I've removed this state and made the reveal logic more robust instead
2022-09-19 07:16:06 +02:00
Matt Bierner
e7b3724e0c Enable no-case-declarations in codebase (#139243)
Fixes #139236

This can catch tricky programming mistakes that cause a runtime error. See 7e266b2c42 as an example of the type of bug this can prevent
2021-12-15 17:15:35 -08:00
Matt Bierner
913639f42a Strip meta http-equiv tags from webview content updates 2021-12-14 11:53:49 -08:00
Matt Bierner
71f615b105 Also compare other attributes for md preview updates
Fixes #136816
2021-11-10 14:13:41 -08:00
Matt Bierner
c11a9ce097 Better update of line numbers 2021-11-04 14:34:49 -07:00
Matt Bierner
4d50e586ec Improve morphing for vscode-docs 2021-11-03 20:54:20 -07:00
Matt Bierner
fbc1f7df91 Fire event when md content is updated
For #136255
2021-11-01 17:41:39 -07:00
Matt Bierner
8f672cac62 Use morphdom to reduce number of full page updates to md preview
This should help improve scroll sync and also reduce the number of times we go out to the network if images are in the preview
2021-11-01 15:33:00 -07:00
Matt Bierner
92418e0ea0 Remove usage of non-standard setImmediate
This was broken after upgrading to webpack5
2021-07-06 12:42:27 -07:00
Matt Bierner
b8f11107f7 Use @types/vscode-webview 2021-05-27 13:41:38 -07:00
Matt Bierner
d5f4e119e0 Use Array.from's map directly instead of a second call to map 2021-04-12 14:42:39 -07:00
Takashi Tamura
a34e751b01 Fix scrolling of markdown preview. Close #65504 (#111094)
* Fix scrolling of markdown preview.

* Use scrollDisabledCount.

* Stop initializing scrollDisabledCount.

* Make scrollTo enough large to occur scroll events.

* Should resolve when the error event occurs.
2021-01-14 17:24:08 -08:00
Matt Bierner
731f9c2563 Prefer using data-href if it exists on a markdown preview link
Fixes #101203
2020-07-23 21:51:18 -07:00
Matt Bierner
7099dc0708 Add extra check to markdown state
Possibly for #102733

Tries to get users out of a potential bad state where the state was being stored as a string. Only insiders users should have hit this
2020-07-16 16:27:42 -07:00
Matt Bierner
9cfd597153 Rework markdown preview code to better support markdown preview editors
Splits the preview part of the markdown preview from the dynamic preview management part of things. Static preview swap to preview the active markdown file and don't scroll sync with any other markdown files
2020-04-11 17:30:12 -07:00
Johannes Rieken
856d085279 run "eslint --fix" to get some changes for free 2020-01-02 20:14:09 +01: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
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
ef698fa6cd Make markdown refresh more stable
Fixes #80680

- Always sync the current preview line number with the editor, even when `scrollEditorWithPreview` is false

- If the md file is focused and refresh is called, do not try resetting the current line to match the editor file. This mainly effects the case where `scrollEditorWithPreview` is false
2019-10-03 13:46:31 -07:00
Matt Bierner
2235ebf5db Handle new vscode-resource format for md linkes
Fixes #81849

This is a safer scoped fix, not the best one. Will look into removing most of this uri munging for october
2019-10-02 14:09:38 -07:00
Salvador Cabrera
34339f92c4 Fix: Markdown Preview scroll remains same after clicking on some other link #78465
Improves the behavior on how markdown preview behaves when clicking a link
2019-08-19 09:35:06 -05:00
Matt Bierner
7f3d3d835f Add vscode.env.webviewResourceRoot api
Fixes #72155

Adds a constant to the api that tracks the root path for resources inside of webviews. This is required because we will not be able to use `vscode-resource:` uris on the web. Our current approach is to rewrite the html we are given but there are almost certainly going to be cases where we don't get this quite right.

Adopts the new api for the markdown preview
2019-06-18 22:29:37 -07:00
Matt Bierner
003521e715 Fix markdown preview restoring to wrong position on restart 2019-02-14 18:24:01 -08:00