Skip to content

Commit

Permalink
fix: Fixed an image bug and parsing slides bug (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
shd101wyy authored Oct 10, 2023
1 parent c906f48 commit 020f077
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Please visit https://github.com/shd101wyy/vscode-markdown-preview-enhanced/relea

## [Unreleased]

## [0.8.22] - 2023-10-10

### Bug fixes

- Fixed a bug of loading image https://github.com/shd101wyy/vscode-markdown-preview-enhanced/issues/1819
- Fixed a bug of parsing slides https://github.com/shd101wyy/vscode-markdown-preview-enhanced/issues/1818

## [0.8.21] - 2023-10-09

### Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "crossnote",
"version": "0.8.21",
"version": "0.8.22",
"description": "A powerful markdown notebook tool",
"keywords": [
"markdown"
Expand Down
2 changes: 1 addition & 1 deletion src/custom-markdown-it-features/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default (md: MarkdownIt, notebook: Notebook) => {
}
}
*/
if (token.children && token.children[0].content === '@embedding') {
if (token.children && token.children[0]?.content === '@embedding') {
const error = token.attrGet('error') ?? '';
if (error) {
return atob(error);
Expand Down
5 changes: 4 additions & 1 deletion src/markdown-engine/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2210,7 +2210,10 @@ sidebarTOCBtn.addEventListener('click', function(event) {
slideConfigs: JsonObject[],
useRelativeFilePath: boolean,
) {
let slides = html.split(/^\s*<p[^>]+>\[CROSSNOTESLIDE\]<\/p>\s*/gm);
let slides = html.split(
/^\s*<p[^>]+><span>\[CROSSNOTESLIDE\]<\/span><\/p>\s*/gm,
);

const before = slides[0];
slides = slides.slice(1);

Expand Down
2 changes: 1 addition & 1 deletion src/markdown-engine/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ export async function transformMarkdown(
lineNo = lineNo + newlines;
outputString =
outputString +
`<p data-source-line="${lineNo + 1}">[CROSSNOTESLIDE]</p>` +
`<span>[CROSSNOTESLIDE]</span> ` +
'\n'.repeat(newlines);
continue;
}
Expand Down

0 comments on commit 020f077

Please sign in to comment.