Skip to content

0.9.42

Choose a tag to compare

@github-actions github-actions released this 08 Oct 14:16
· 25 commits to develop since this release

Bug fixes

  • Pandoc math rendering no longer trips the pandoc 3.11 deprecation warning — pandoc 3.11 deprecated the bare --mathjax and --katex flags in favour of --math-method=…, and crossnote passed the old flags on every pandoc-parser render — worse than a log line, pandocRender turns any stderr into a visible error block above the document, so every preview of a note with MathJax or KaTeX showed [WARNING] Deprecated: --mathjax…. The flags are now chosen per pandoc binary: --math-method=mathjax/katex when the configured pandoc understands it (probed once per binary), the legacy flags otherwise — older pandoc rejects the new option outright, so an unconditional switch would have broken every pandoc before 3.11. Output is byte-identical between the two spellings; the probe caches its promise so concurrent parses share one pandoc --version run (#531 by @shd101wyy; #529 reported by @nredick).

Features

  • ```csv code blocks render as tables — a fenced csv block is now parsed with papaparse (the same parser @import "file.csv" uses) and shown as an HTML table, with the first row as the header. Quoted cells may contain commas, the delimiter is auto-detected (so ;-separated data works too), and every cell is HTML-escaped. Add {code_block=true} to show the CSV source instead, as with the other diagram blocks. A malformed block shows the parse error in place of the table (#527 by @iryansa; vscode-mpe#1534 reported by @8).

Improvements

  • Large notebooks index meaningfully faster — profiling the full index build on a 1,850-note notebook (~/Workspace/Yo) showed the walk calling stat on every file and then loadNoteFromDisk stat'ing each one again to decide whether it was indexable markdown, so every non-markdown file in the tree paid two stats to be rejected, and files within one directory were stat'd and read strictly sequentially. The walk now applies the markdown-extension and maxNoteFileSize gates itself (one stat per entry, results handed to the loader) and processes a directory's entries concurrently; subdirectory recursion, .gitignore handling, symlink refusal and the runaway-walk warning are unchanged. Measured on the profile notebook: the load phase drops from ~2.6 s to ~2.0 s warm-cache (the gap widens on a cold cache, where the removed stats and parallel reads are more expensive), stat calls fall from ~15,300 to ~8,300 for 1,849 notes, and the index contents are byte-identical. The remaining cost is the per-note markdown-it tokenization (~2.8 s of pure CPU on that notebook), which is sequential single-threaded work; making it cheaper would require either a second, leaner parser instance whose token stream would subtly diverge from the renderer's, or worker threads — both deliberately left out (#532 by @shd101wyy).

Bug fixes

  • GitHub-style light/dark <picture> images show in the preview, and follow the preview theme — READMEs mark theme variants with <picture><source media="(prefers-color-scheme: dark)" srcset="…-dark.svg"><img src="…-light.svg"></picture>. The preview resolved <img src> to a loadable URL but left srcset relative, so it resolved against the webview document (vscode-webview://<uuid>/): whenever the dark <source> matched, the browser committed to it and showed a broken image instead of falling back to the <img>. srcset on <img> and <source> is now resolved exactly like src, one candidate URL at a time, keeping 1x/480w descriptors. This also fixes Open in Browser and Chrome (PDF/PNG) export, which render with absolute file:// URLs; HTML export keeps relative paths and is unchanged. Inside the preview, prefers-color-scheme reports the system scheme, which can differ from the preview theme, so a <source> whose media is exactly a prefers-color-scheme query is now matched against the preview's rendered background (the same test that sets data-preview-theme) and re-evaluated when the theme changes — as on GitHub, the image follows the page it is drawn on. Other media queries, and exported HTML (see exportColorScheme), keep standard browser behavior (#521 by @eneskemalergin; vscode-mpe#2271 reported by @garysassano).

  • @import of files without an extension, and data URI images, work again — since the Obsidian-style link resolution (#429), @import "x" and a lone ![](x) resolve x through resolveWikilink(), which appends .md when there is no extension. @import "Caddyfile" therefore failed with ENOENT … Caddyfile.md (before #429 it was shown as a broken image), contrary to the documented "all other files will be rendered as code block" (vscode-mpe#2236 reported by @traits); and a ![](data:image/…) alone on a line was treated as a file import of data:image/….md (vscode-mpe#2241 reported by @piknockyou). A lone data URI image is now an ordinary image; an extensionless name that exists as written next to the note is imported as that file (and shown as a code block), while @import "note" still finds note.md; and a target without an extension is treated as an image only for remote URLs and ![](…) image syntax. markdown-it also accepts data:image/svg+xml in ![](…) now — it already allowed PNG, GIF, JPEG and WebP, and raw HTML <img src="data:image/svg+xml,…"> already rendered, so this allows nothing new. javascript: and data:text/html links are still rejected (#523 by @eneskemalergin).

  • @import by absolute location works again: Windows paths and file:// URLs — since the Obsidian-style link resolution (#429), an import target that does not start with / goes through resolveWikilink(), which in the default relative mode joins it under the note's folder (D:\notes\C:\folder\my-style.less), so <!-- @import "C:/folder/my-style.less" --> (which worked up to MPE 0.8.20) no longer found the file. A file:///C:/folder/my-style.less URL was handed to the file reader as-is and failed with ENOENT (vscode-mpe#2349 reported by @suminosin). Windows drive and UNC paths are now used as written, and file:// URLs are read from the file they name. A file:// .css import is still linked by its file:// URL, which the VS Code preview cannot load; .less is compiled inline and works. A leading / still means the project root. .js imports keep their notebook-directory-only rule, and a file:// .js import still emits no script (#524 by @eneskemalergin).

  • Local image and link URLs are no longer double-encoded, and @import images load again outside the preview — since addFileProtocol() switched to pathToFileURL() (#468), resolveFilePath() fed it link text that was already a URL: markdown-it percent-encodes ![](图.png) to %E5%9B%BE.png, so Open in Browser and Chrome (PDF/PNG) export, which render with absolute file:// URLs, got %25E5%259B%25BE.png and the image was missing (vscode-mpe#2441 reported by @NarrowWoodBridge); and the ?cache-buster that @import "image.png" appends became part of the file name (image.png%3F0.55), which broke imported images in Open in Browser and Chrome export and in hosts that map file paths to URLs themselves (such as crossnote serve). HTML export keeps relative paths and was not affected (vscode-mpe#2328 reported by @ahoy123). resolveFilePath() now splits the ?query#fragment off the link, decodes the path once, resolves it, and re-attaches the suffix to the URL the host built, so hosts always receive a real file path. @import images now write their path as a URL (#, ?, %, spaces and parentheses escaped) instead of only replacing spaces. A file whose name contains a literal %xx sequence is now read the way a browser reads the link (a%20b.png means a b.png). Notebook-root-relative destinations in relative renders (/img.png with useRelativeFilePath) are now written as URL paths (forward slashes, %, #, ? and spaces escaped) with the query/fragment preserved, instead of raw OS paths. As a side effect ![](dark.png#gh-dark-mode-only) and [x](other.md#section) keep their fragment instead of having it encoded into the file name (#522 by @eneskemalergin).