Skip to content

Commit

Permalink
Feat: use new separated diagram extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 committed Apr 14, 2022
1 parent 74338c1 commit d615040
Show file tree
Hide file tree
Showing 6 changed files with 3,806 additions and 1,584 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agoose77/jupyterlab-markup",
"version": "1.1.0",
"version": "2.0.0",
"description": "Additional markdown rendering support in JupyterLab.",
"keywords": [
"jupyter",
Expand Down Expand Up @@ -58,7 +58,8 @@
"markdown-it": "^12.3.2",
"markdown-it-anchor": "^6.0.0",
"markdown-it-deflist": "^2.0.3",
"markdown-it-diagrams": "0.2.0-alpha.0",
"@agoose77/markdown-it-svgbob": "0.1.0a0",
"@agoose77/markdown-it-mermaid": "0.1.0a0",
"markdown-it-footnote": "^3.0.2",
"markdown-it-task-lists": "^2.1.1",
"react": "^17.0.1"
Expand Down
42 changes: 0 additions & 42 deletions src/builtins/diagrams.ts

This file was deleted.

5 changes: 3 additions & 2 deletions src/builtins/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { anchor } from './anchor';
import { deflist } from './deflist';
import { diagrams } from './diagrams';
import { svgbob } from './svgbob';
import { mermaid } from './mermaid';
import { footnote } from './footnote';
import { taskLists } from './task-lists';

/**
* Builtin plugins provided by this labextension
*/
export const BUILTINS = [anchor, deflist, diagrams, footnote, taskLists];
export const BUILTINS = [anchor, deflist, footnote, mermaid, svgbob, taskLists];
30 changes: 30 additions & 0 deletions src/builtins/mermaid.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { PACKAGE_NS, simpleMarkdownItPlugin } from '..';

/**
* Provides text-based diagrams in code blocks
*/
export const mermaid = simpleMarkdownItPlugin(PACKAGE_NS, {
id: '@agoose77/markdown-it-mermaid',
title: 'Mermaid',
description: 'Create diagrams and visualizations using text and code.',
documentationUrls: {
Plugin: 'https://github.com/agoose77/markdown-it-mermaid',
MermaidJS: 'https://mermaid-js.github.io/mermaid'
},
examples: {
'Mermaid Flowchart': `
\`\`\`mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
\`\`\``
},
plugin: async () => {
const mermaidPlugin = await import(
/* webpackChunkName: "markdown-it-diagrams" */ '@agoose77/markdown-it-mermaid'
);
return [mermaidPlugin.default];
}
});
33 changes: 33 additions & 0 deletions src/builtins/svgbob.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { PACKAGE_NS, simpleMarkdownItPlugin } from '..';

/**
* Provides ASCII diagrams in code blocks
*/
export const svgbob = simpleMarkdownItPlugin(PACKAGE_NS, {
id: '@agoose77/markdown-it-svgbob',
title: 'Svgbob',
description: 'ASCII diagrams rendered by Svgbob',
documentationUrls: {
Plugin: 'https://github.com/agoose77/markdown-it-svgbob',
svgbob: 'https://github.com/ivanceras/svgbob'
},
examples: {
svgbob: `
\`\`\`svgbob
.---.
/-o-/--
.-/ / /->
( * \\/
'-. \\
\\ /
'
\`\`\`
`
},
plugin: async () => {
const factory = await import(
/* webpackChunkName: "markdown-it-diagrams" */ '@agoose77/markdown-it-svgbob'
);
return [await factory.default()];
}
});
Loading

0 comments on commit d615040

Please sign in to comment.