Skip to content

Commit

Permalink
0.9.10 (#359)
Browse files Browse the repository at this point in the history
* chore: Updated nix and nodejs version

* feat: Updated mermaid to the latest version 11.1.1

* chore: Update katex dependency to version 0.16.11

* feat: Add support for .mdx files in markdownFileExtensions

* fix: Fixed one scroll sync bug

* chore: Update package.json version to 0.9.10

* feat: Add support for .mdx files in markdownFileExtensions
  • Loading branch information
shd101wyy authored Sep 7, 2024
1 parent 5254777 commit 9708d58
Show file tree
Hide file tree
Showing 12 changed files with 1,355 additions and 1,197 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ Please visit https://github.com/shd101wyy/vscode-markdown-preview-enhanced/relea

## [Unreleased]

## [0.9.10] - 2024-09-07

### Changes

- Added `.mdx` to the default `markdownFileExtensions`.

### Updates

- Updated `mermaid` version to the latest `11.1.1`.
- Updated `katex` version to the latest `v0.16.11`.

### Bug fixes

- Fixed a scroll sync bug.

## [0.9.9] - 2024-03-11

### Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ main();
```js
const config = {
// File of extensions to be included in the notebook
markdownFileExtensions: [".md", ".markdown", ".mdown", ".mkdn", ".mkd", ".rmd", ".qmd"],
markdownFileExtensions: [".md", ".markdown", ".mdown", ".mkdn", ".mkd", ".rmd", ".qmd", ".mdx"],

// The content to be included in HTML `<head>` tag.
// This is useful for adding custom styles or scripts.
Expand Down
4 changes: 2 additions & 2 deletions dependencies/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ I managed some of the libraries by myself instead of through npm to reduce the o
{
"font-awesome": "6.4.2", // Download from here: https://fontawesome.com/download
// Fontawesome cheatsheet is available here: https://kapeli.com/cheat_sheets/Font_Awesome.docset/Contents/Resources/Documents/index
"katex": "v0.16.9", // Only keep the css and fonts files.
"mermaid": "10.9.0", // https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js
"katex": "v0.16.11", // Only keep the css and fonts files.
"mermaid": "11.1.1", // https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js
"reveal": "4.6.0",

// NOTE: Don't forget to update `dependentLibraryMaterials` in `markdown-engine/index.ts`
Expand Down
2 changes: 1 addition & 1 deletion dependencies/katex/katex.min.css

Large diffs are not rendered by default.

1,743 changes: 950 additions & 793 deletions dependencies/mermaid/mermaid.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions flake.lock

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

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-23.11";
url = "github:NixOS/nixpkgs/nixos-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils = { url = "github:numtide/flake-utils"; };
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "crossnote",
"version": "0.9.9",
"version": "0.9.10",
"description": "A powerful markdown notebook tool",
"keywords": [
"markdown"
Expand Down Expand Up @@ -81,7 +81,7 @@
"html-to-image": "^1.11.11",
"imagemagick-cli": "^0.5.0",
"jquery": "^3.7.1",
"katex": "^0.16.9",
"katex": "^0.16.11",
"less": "^4.2.0",
"markdown-it": "^13.0.1",
"markdown-it-abbr": "^1.0.4",
Expand All @@ -93,7 +93,7 @@
"markdown-it-sub": "^1.0.0",
"markdown-it-sup": "^1.0.0",
"md5": "^2.3.0",
"mermaid": "^10.9.0",
"mermaid": "^11.1.1",
"minisearch": "^6.1.0",
"mkdirp": "^3.0.1",
"monaco-editor": "^0.43.0",
Expand Down
6 changes: 3 additions & 3 deletions src/markdown-engine/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ window["initRevealPresentation"] = async function() {
'./dependencies/katex/katex.min.css',
)}">`;
} else {
mathStyle = `<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/katex@0.16.9/dist/katex.min.css">`;
mathStyle = `<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/katex@0.16.11/dist/katex.min.css">`;
}
} else {
mathStyle = '';
Expand Down Expand Up @@ -812,7 +812,7 @@ window["initRevealPresentation"] = async function() {
'./dependencies/mermaid/mermaid.min.js',
)}" charset="UTF-8"></script>`;
} else {
mermaidScript = `<script src="https://${this.notebook.config.jsdelivrCdnHost}/npm/mermaid@10.9.0/dist/mermaid.min.js"></script>`;
mermaidScript = `<script src="https://${this.notebook.config.jsdelivrCdnHost}/npm/mermaid@11.1.1/dist/mermaid.min.js"></script>`;
}

mermaidInitScript += `<script type="module">
Expand Down Expand Up @@ -1730,7 +1730,7 @@ sidebarTOCBtn.addEventListener('click', function(event) {
ebookConfig['html'] &&
ebookConfig['html'].cdn
) {
mathStyle = `<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/katex@0.16.9/dist/katex.min.css">`;
mathStyle = `<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/katex@0.16.11/dist/katex.min.css">`;
} else {
mathStyle = `<link rel="stylesheet" href="file:///${path.resolve(
utility.getCrossnoteBuildDirectory(),
Expand Down
3 changes: 2 additions & 1 deletion src/notebook/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export type WikiLinkTargetFileNameChangeCase =
export interface NotebookConfig {
/**
* The files of extensions to be included in the notebook
* @default [".md", ".markdown", ".mdown", ".mkdn", ".mkd", ".rmd", ".qmd"]
* @default [".md", ".markdown", ".mdown", ".mkdn", ".mkd", ".rmd", ".qmd", ".mdx"]
*/
markdownFileExtensions: string[];
/**
Expand Down Expand Up @@ -533,6 +533,7 @@ export function getDefaultNotebookConfig(): NotebookConfig {
'.mkd',
'.rmd',
'.qmd',
'.mdx',
],
globalCss: '',
includeInHeader: '',
Expand Down
7 changes: 4 additions & 3 deletions src/webview/containers/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,16 @@ const PreviewContainer = createContainer(() => {
if (t < nonEmptyList[nonEmptyList.length - 1]) {
el.removeAttribute('data-source-line');
} else {
nonEmptyList.push(t);

let offsetTop = 0;
while (el && el !== previewElement.current) {
offsetTop += el.offsetTop;
el = el.offsetParent as HTMLElement;
}

newScrollMap[t] = Math.round(offsetTop);
if (offsetTop > 0) {
nonEmptyList.push(t);
newScrollMap[t] = Math.round(offsetTop);
}
}
}

Expand Down
Loading

0 comments on commit 9708d58

Please sign in to comment.