Closed shah closed 3 years ago
It would be better to use *.md.ts
model where the entire Markdown is a Typescript or JS module. This way, frontmatter and others can be dynamic but typesafe too. The nice thing about Deno templates is that they're dynamic, cachable, and remotable (can be sourced from anywhere on the Internet).
Example test.md.ts
:
// in *.md.ts all exported symbols are considered "typed" frontmatter
export const title = "Site Workstation Specs Generated";
export const layout: govn.RenderStrategyIdentity = "my/layout/name";
// non-exported symbols can be used in the Markdown but are not treated as frontmatter
const someOtherVar = "value";
const someOtherVar2 = "value";
// the default text is considered the markdown content and may be completely dynamic
export default `
# heading1
${await fetch("completely dynamic URL example")}
${Deno.readTextFileSync("completely dynamic.txt")}
`;
We need to implement mustache.js, M4 or more specifically any really fast logicless template engine for:
For frontmatter:
Frontmatter is allowed in HTML and Markdown files and should be pre-/post-processable to allow dynamic functionality. Markdown is basically just information architecture so allowing it to be dynamic is good.