In the previous article, we set up a FastAPI service and used Jinja2 to render a dynamic HTML template.

But if you’ve used other documentation site tools, you’ll know they all work by writing Markdown, which they then use to generate HTML content, rather than writing HTML by hand.

In this article, we will implement this exact feature: reading a local .md file, parsing it into HTML, and injecting it into our web template.

Step 1: Install a Markdown Parsing Library

We need a tool to convert Markdown text into an HTML string. A popular library for this is python-markdown.

Install it by running the following command:

pip install markdown

Step 2: Create Our First Markdown D…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help