Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
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 tailwindcss from "@tailwindcss/vite";
|
||||||
import { unified } from '@astrojs/markdown-remark';
|
import { unified } from '@astrojs/markdown-remark';
|
||||||
import { ScriptureLinks } from './src/utils/rehype';
|
import { ScriptureLinks } from './src/utils/rehype';
|
||||||
|
import { ScriptureMark } from './src/utils/remark';
|
||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
|
@ -14,6 +15,7 @@ export default defineConfig({
|
||||||
markdown: {
|
markdown: {
|
||||||
processor: unified({
|
processor: unified({
|
||||||
rehypePlugins: [ScriptureLinks],
|
rehypePlugins: [ScriptureLinks],
|
||||||
|
remarkPlugins: [ScriptureMark],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
vite: {
|
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