#render title of content as inline MDX at build time

6 messages · Page 1 of 1 (latest)

drifting plover
drifting plover
#

@rustic oracle

rustic oracle
#

I'm not familiar with Katex. But from the example at the link you shared, you could do the same:

---
// Example: Fetch Markdown from a remote API
// and render it to HTML, at runtime.
// Using "marked" (https://github.com/markedjs/marked)
import { marked } from 'marked';
const response = await fetch("from Katex");
const title = await response.text();
const title= marked.parse(title);
---
<h1 set:html={title} />
drifting plover
#

I get why it wouldn't be possible for SSR (you'd need mdx infrastructure which is only accessible at build time), but it sounds like it should be 100% doable at build time

#

i'd rather not maintain two different katex plugins for the content of the post and the titles/descriptions