ERD Diagrams in Markdown
How to create Entity-Relationship Diagrams (ERD) using plain text.
ERD (Entity-Relationship Diagram) is a tool that translates plain text descriptions of relational database schemas into graphical diagrams. It’s incredibly useful for documenting database schemas quickly and keeping them close to your code.
In MarkdownToPrettyPDF, you can create these diagrams using the erd language block.
Basic Syntax
Entities are defined just by stating their name. You can add attributes enclosed in curly braces {}, and you can define relationships with standard connector syntax.
|
|
|
Advanced Syntax
You can use standard ER notation for cardinality:
1: exactly one?: zero or one*: zero or more+: one or more
|
|
|
Styling and Layout
The ERD tool automatically handles the layout, producing clean, structured diagrams representing your data model. Attributes marked with * are rendered as primary keys, while + denotes foreign keys.
Using the erd tool is an excellent way to maintain up-to-date and easily readable database schemas right within your documentation.