Files
website-v2/core/markdown.py
Greg Newman 2487c62d28 🚧 Markdown renderer
* Stubbed out TemplateView for rendering markdown files
* Added a BoostRenderer class to parse the markdown files to support the first iteration of a youtube shortcode and also a Pygments renderer for code blocks.
* Added default styles for some common markup so the rendered markdown looks better.

The pygments renderer is set to use Solarized Dark right now because that’s the closest I see that matches the design of the site.  This can be changed in the class.
2022-09-10 11:07:42 -04:00

17 lines
406 B
Python

import frontmatter
from core.boostrenderer import BoostRenderer
from mistletoe import Document
def process_md(filename):
with open(filename) as f:
post = frontmatter.load(f)
metadata = post.metadata
content = post.content
with BoostRenderer() as renderer:
doc = Document(content)
rendered = renderer.render(doc)
return metadata, rendered