From 5237aca552ca6f3fe572e6d4d94422dd117d70b2 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Shelton" Date: Sat, 18 Jul 2026 13:20:22 -0600 Subject: [PATCH] Added [[type: ]] 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. --- astro.config.mjs | 2 ++ src/utils/remark.js | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) 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