Added [[type: <text>]] Markdown extension for future use.
Currently this is only for adding inline quotations (.e.g the [text](:quote) markup), but I need to think a little about how to structure the actual HTML markup for this.
This commit is contained in:
parent
4138854966
commit
5237aca552
2 changed files with 18 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import mdx from '@astrojs/mdx';
|
|||
import tailwindcss from "@tailwindcss/vite";
|
||||
import { unified } from '@astrojs/markdown-remark';
|
||||
import { ScriptureLinks } from './src/utils/rehype';
|
||||
import { ScriptureMark } from './src/utils/remark';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
|
|
@ -14,6 +15,7 @@ export default defineConfig({
|
|||
markdown: {
|
||||
processor: unified({
|
||||
rehypePlugins: [ScriptureLinks],
|
||||
remarkPlugins: [ScriptureMark],
|
||||
}),
|
||||
},
|
||||
vite: {
|
||||
|
|
|
|||
|
|
@ -20,4 +20,19 @@ export const ScriptureLinks = () => {
|
|||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export const ScriptureMark = () => {
|
||||
return async tree => {
|
||||
visit(tree, 'text', (node, index, parent) => {
|
||||
if (node.value.includes('[[quote:')) {
|
||||
const text = node.value.substring(8, node.value.length-2);
|
||||
const newNode = {
|
||||
type: 'html',
|
||||
value: `<span class="quote">${text}</span>`,
|
||||
};
|
||||
parent.children[index] = newNode;
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
Loading…
Reference in a new issue