Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use vscode-markdown-it-katex to render kaTex #386

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
node_modules/
.history
.vscode-test
node_modules
work/**
*.vsix
*.bat
.eslintrc.json
/extension.js
17 changes: 9 additions & 8 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
.vscode/**
typings/**
test/**
.github/
.vscode/
node_modules/
sample/
test/
.gitignore
jsconfig.json
*.vsix
work/**
*.bat
.eslintrc.json
sample/**
esbuild.js
extension.js.map
jsconfig.json
src/extension.js
16 changes: 16 additions & 0 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* [markdown-it-checkbox](https://github.com/mcecot/markdown-it-checkbox)
* [markdown-it-container](https://github.com/markdown-it/markdown-it-container)
* [markdown-it-include](https://github.com/camelaissani/markdown-it-include)
* [markdown-it-katex](https://github.com/microsoft/vscode-markdown-it-katex)
* [PlantUML](https://plantuml.com/)
* [markdown-it-plantuml](https://github.com/gmunguia/markdown-it-plantuml)
* [mermaid](https://mermaid-js.github.io/mermaid/)
Expand Down Expand Up @@ -105,6 +106,21 @@ Content of plugins/README.md
Content of CHANGELOG.md
```

### markdown-it-katex

INPUT

```
$$
\sqrt{3x-1}+(1+x)^2
$$
```

OUTPUT

![katex](images/katex.png)


### mermaid

INPUT
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Supports the following features
* [markdown-it-checkbox](https://github.com/mcecot/markdown-it-checkbox)
* [markdown-it-container](https://github.com/markdown-it/markdown-it-container)
* [markdown-it-include](https://github.com/camelaissani/markdown-it-include)
* [markdown-it-katex](https://github.com/microsoft/vscode-markdown-it-katex)
* [PlantUML](https://plantuml.com/)
* [markdown-it-plantuml](https://github.com/gmunguia/markdown-it-plantuml)
* [mermaid](https://mermaid-js.github.io/mermaid/)
Expand Down Expand Up @@ -107,6 +108,20 @@ Content of plugins/README.md
Content of CHANGELOG.md
```

### markdown-it-katex

INPUT

```
$$
\sqrt{3x-1}+(1+x)^2
$$
```

OUTPUT

![katex](images/katex.png)

### mermaid

INPUT
Expand Down
56 changes: 56 additions & 0 deletions esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const esbuild = require('esbuild');

const production = process.argv.includes('--production');
const watch = process.argv.includes('--watch');

async function main() {
const ctx = await esbuild.context({
entryPoints: ['src/extension.js'],
bundle: true,
format: 'cjs',
minify: production,
sourcemap: !production,
sourcesContent: false,
platform: 'node',
outfile: 'extension.js',
external: ['vscode'],
logLevel: 'silent',
plugins: [
/* add to the end of plugins array */
esbuildProblemMatcherPlugin,
],
});
if (watch) {
await ctx.watch();
} else {
await ctx.rebuild();
await ctx.dispose();
}
}

/**
* @type {import('esbuild').Plugin}
*/
const esbuildProblemMatcherPlugin = {
name: 'esbuild-problem-matcher',

setup(build) {
build.onStart(() => {
console.log('[watch] build started');
});
build.onEnd((result) => {
result.errors.forEach(({ text, location }) => {
console.error(`✘ [ERROR] ${text}`);
console.error(
` ${location.file}:${location.line}:${location.column}:`
);
});
console.log('[watch] build finished');
});
},
};

main().catch((e) => {
console.error(e);
process.exit(1);
});
Binary file added images/katex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading