Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v5

- name: Install pnpm
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v6

- name: Install nodejs
uses: actions/setup-node@v6
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v6

- name: Install nodejs
uses: actions/setup-node@v6
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v6

- name: Install nodejs
uses: actions/setup-node@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/typedoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v6

- name: Install nodejs
uses: actions/setup-node@v6
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

Please visit https://github.com/shd101wyy/vscode-markdown-preview-enhanced/releases for the more changelog

## [Unreleased]

## [0.9.30] - 2026-06-06

### Security

- **Fix a remote code execution vulnerability in `.crossnote/config.js` and `.crossnote/parser.js` evaluation**. These workspace files are now evaluated inside a [QuickJS](https://github.com/justjake/quickjs-emscripten) WebAssembly sandbox so untrusted code from a repository can no longer reach the host environment. Thanks to @ritikchaddha for reporting the issue.

### Bug fixes

- **Fix heading auto-ID generation for underscore-based italic/bold** — When a heading used underscore-based emphasis at the beginning or end (e.g., `_Toy Story_` or `__Bold Title__`), the generated heading ID would retain the underscores (e.g., `_toy-story_`), which markdown-it would interpret as emphasis markers, splitting the `{#id data-source-line="N"}` attribute block across multiple tokens and leaving it visible in the rendered output. Heading IDs now strip underscore emphasis markers following CommonMark rules — boundaries include punctuation (`# x _foo bar_! end` → `x-foo-bar-end`), adjacent runs both match (`_a_ _b_` → `a-b`), and intraword underscores are kept (`foo_bar_` → `foo_bar_`) — matching the anchors GitHub generates for the same headings. Additionally, ids embedded in the internal `{#id}` attribute block are now backslash-escaped so that any id still containing `_`/`*` survives inline parsing intact and rendered heading ids always match TOC anchors. Fixes [vscode-mpe#2319](https://github.com/shd101wyy/vscode-markdown-preview-enhanced/issues/2319). Reported by @skycommand.
- **Fix `@import` / `![[wikilink]]` file resolution when the file path contains `#`** — When a project directory name contains `#` (e.g., `[#11111111]`), the `@import` and wikilink-based file imports would fail because the `#` in the directory name was incorrectly treated as a heading anchor fragment separator during post-resolution path splitting. The `#fragment` is now extracted from the original import syntax before path resolution, so literal `#` characters in directory paths are preserved (and `%23` can be used to write a literal `#` in import paths). Also fixed line-level `![[note^block-id]]` embeds (bare block reference without `#`), which previously failed to resolve the target block. Fixes [vscode-mpe#2317](https://github.com/shd101wyy/vscode-markdown-preview-enhanced/issues/2317). Reported by @LY1806620741.

## [0.9.29] - 2026-06-05

### Bug fixes
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "crossnote",
"version": "0.9.29",
"version": "0.9.30",
"description": "A powerful markdown notebook tool",
"keywords": [
"markdown"
Expand Down Expand Up @@ -68,6 +68,7 @@
"dependencies": {
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@jitl/quickjs-singlefile-cjs-release-sync": "^0.32.0",
"@mdi/js": "^7.2.96",
"@mdi/react": "^1.6.1",
"@monaco-editor/react": "^4.5.2",
Expand Down Expand Up @@ -130,14 +131,14 @@
"plantuml-encoder": "^1.4.0",
"puppeteer-core": "^24.16.2",
"qiniu": "^7.9.0",
"quickjs-emscripten-core": "^0.32.0",
"react": "^18.2.0",
"react-contexify": "^6.0.0",
"react-dom": "^18.2.0",
"reading-time": "^1.5.0",
"sharp": "^0.33.5",
"simple-icons": "^9.13.0",
"slash": "^5.1.0",
"sval": "^0.6.9",
"twemoji": "^13.1.0",
"type-fest": "^4.3.1",
"unstated-next": "^1.1.0",
Expand Down
42 changes: 25 additions & 17 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions src/custom-markdown-it-features/curly-bracket-attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default (md: MarkdownIt) => {
if (!headingInline.children || headingInline.children.length === 0) {
continue;
}
let matched = false;
const lastChild =
headingInline.children[headingInline.children.length - 1];
if (lastChild.type === 'text') {
Expand All @@ -29,6 +30,55 @@ export default (md: MarkdownIt) => {
for (const key in attributes) {
tokens[i].attrJoin(key, attributes[key]);
}
matched = true;
}
}

// Defense-in-depth: if the {#...} block was split across tokens (e.g.,
// underscores inside the block were interpreted as emphasis markers by
// markdown-it), join all text children and find the pattern that way.
if (!matched) {
let combinedText = '';
for (let j = 0; j < headingInline.children.length; j++) {
if (headingInline.children[j].type === 'text') {
combinedText += headingInline.children[j].content;
}
}
const combinedMatch = combinedText.match(/\{([^}]+)\}\s*$/);
if (combinedMatch) {
const patternStart =
combinedText.length - combinedMatch[0].length;
let offset = 0;
let foundIdx = -1;
let posInToken = -1;
for (let j = 0; j < headingInline.children.length; j++) {
const child = headingInline.children[j];
if (child.type === 'text') {
if (
patternStart >= offset &&
patternStart < offset + child.content.length
) {
foundIdx = j;
posInToken = patternStart - offset;
break;
}
offset += child.content.length;
}
}
if (foundIdx >= 0) {
headingInline.children[foundIdx].content =
headingInline.children[foundIdx].content
.slice(0, posInToken)
.trimEnd();
headingInline.children.length = foundIdx + 1;
headingInline.children = headingInline.children.filter(
(c) => c.type !== 'text' || c.content.length > 0,
);
const attributes = parseBlockAttributes(combinedMatch[1]);
for (const key in attributes) {
tokens[i].attrJoin(key, attributes[key]);
}
}
}
}
}
Expand Down
Loading
Loading