diff --git a/astro.config.mjs b/astro.config.mjs index f33dcd8..4c40e5c 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -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: { diff --git a/src/utils/remark.js b/src/utils/remark.js index 9aadddf..6b2b696 100644 --- a/src/utils/remark.js +++ b/src/utils/remark.js @@ -20,4 +20,19 @@ export const ScriptureLinks = () => { } }); }; -}; \ No newline at end of file +}; + +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: `${text}`, + }; + parent.children[index] = newNode; + } + }); + }; +} \ No newline at end of file