Skip to content

Commit

Permalink
feat: Add markdown-it-plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith <[email protected]>
  • Loading branch information
GordonSmith committed Oct 10, 2024
1 parent a855017 commit 213c556
Show file tree
Hide file tree
Showing 35 changed files with 2,112 additions and 16 deletions.
98 changes: 82 additions & 16 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"xpackages/loader",
"xpackages/map",
"xpackages/map-deck",
"packages/markdown-it-plugins",
"xpackages/marshaller",
"packages/observable-shim",
"packages/observablehq-compiler",
Expand Down
2 changes: 2 additions & 0 deletions packages/markdown-it-plugins/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vitepress/cache
.vitepress/dist
62 changes: 62 additions & 0 deletions packages/markdown-it-plugins/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { defineConfig } from "vitepress";
import { observable } from "@hpcc-js/markdown-it-plugins";
import { eclLang } from "@hpcc-js/markdown-it-plugins/ecl-lang";

// https://vitepress.dev/reference/site-config
export default async () => {

return defineConfig({
title: "@hpcc-js/markdown-it-plugins",
description: "ObservableHQ plugin for markdown-it",
base: "/Visualization/markdown-it-plugins",
srcDir: ".",
rewrites: {
'docs/index.md': 'index.md'
},
lastUpdated: true,
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: "Home", link: "/" },
{ text: "Getting Started", link: "/README" },
{ text: "Documentation", link: "/docs/observablehq-markdown-it" },
],

sidebar: [
{ text: "Getting Started", link: "/README" },
{
text: "Documentation",
items: [
{
text: "markdown-it",
items: [
{ text: "ObservableHQ", link: "/docs/observablehq-markdown-it" },
]
},
{
text: "VitePress",
items: [
{ text: "ObservableHQ", link: "/docs/observablehq-vitepress" },
{ text: "ECL Code Highlighting", link: "/docs/ecl-vitepress" }
]
}
]
}
],

socialLinks: [
{ icon: "github", link: "https://github.com/hpcc-systems/visualization" }
],

},
markdown: {
// https://github.com/vuejs/vitepress/blob/main/src/node/markdown/markdown.ts
config: md => {
md.use(observable, { vitePress: true });
},

languages: [eclLang()],
},

});
};
19 changes: 19 additions & 0 deletions packages/markdown-it-plugins/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// https://vitepress.dev/guide/custom-theme
import { h } from "vue";
import type { Theme } from "vitepress";
import DefaultTheme from "vitepress/theme";
import RenderComponent from "@hpcc-js/markdown-it-plugins/vitepress/RenderComponent.vue";
import "@hpcc-js/markdown-it-plugins/vitepress/style.css";

export default {
extends: DefaultTheme,
Layout: () => {
return h(DefaultTheme.Layout, null, {
// https://vitepress.dev/guide/extending-default-theme#layout-slots
});
},
enhanceApp({ app }) {
app.component("RenderComponent", RenderComponent);
},

} satisfies Theme;
47 changes: 47 additions & 0 deletions packages/markdown-it-plugins/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "test-browser",
"type": "msedge",
"request": "launch",
"url": "http://localhost:8888",
"webRoot": "${workspaceFolder}",
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
],
},
{
"name": "test-node",
"type": "node",
"request": "launch",
"runtimeArgs": [
"run-script",
"test-node"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
],
},
{
"name": "index.html",
"request": "launch",
"type": "msedge",
"url": "file:///${workspaceFolder}/index.html",
"runtimeArgs": [
"--disable-web-security"
],
"webRoot": "${workspaceFolder}",
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
]
}
]
}
Loading

0 comments on commit 213c556

Please sign in to comment.