Markdown overview
Markdown is a markup language mainly used for writing documentation. Its extension is .md
, and most of the IDEs provide a previewer of the written documents. This post will cover basic syntax, some use cases with examples, and different flavors.
Basics
Headers
# some text for h1 header
## some text for h2 header
### some text for h3 header
#### some text for h4 header
##### some text for h5 header
###### some text for h6 header
Blockquotes
> some text
Links
- External links
[link text](link URL)
- Internal links (e.g., the link to Gitlab flavored header)
- [Gitlab flavored](#gitlab-flavored)
- External links
Images
![image description](image URL)
Space between paragraphs
- blank line
Lists
- unordered- list item- sublist item- list item- subitem item
- ordered1. post1. post1. post
- unordered
Text modifications
Highlighted
- `text`
Bold
- **text**
Italic
- *text*
Underlined
- <u>underlined</u>
Strike-through
- ~~some text~~
Tables
- | Hackathon | Location | Date || --------- | -------- | ---- || [hackathon](URL) | place | 1-2 June 2023 |
Code snippets with syntax highlighting
- ```jsconsole.log('Hello world');```
HTML tags and entities
- <p>paragraph with some text <3</p>
Comments
- <!-- this is a comment text -->
Escape characters
- \> not a blockquote text
Show markdown content without rendering
- ````markdown```jsconsole.log('Hello world');```````
- ~~~```jsconsole.log('Hello world');```~~~
Usage
Documentation
Every repository should contain a Readme file with (at least) a project description and instructions on how to set up the project, run it, run the tests, and which technologies are used. Here is the link to the template example.
Blog posts
This post is written in Markdown and converted to HTML.
Diagrams
Different diagrams can be written in PlantUML. Check the rendered output in PlantUML editor.
Sequence diagrams
@startumlUser -> PaymentService: POST /paymentsPaymentService -> PaymentService: handlePayment()PaymentService -> User: response@endumlArchitecture diagrams
@startumltitle Calculationpackage calculationService {database postgres {collections scorescollections users}interface POST_calculationsinterface GET_calculated_scorescomponent calculatorcomponent scoreServiceinterface userEventConsumer}package worker {component schedulerinterface userEventProducer}package gateway {interface GET_scores}file USER_EVENTactor UseruserEventProducer --> USER_EVENT: Message event flowUSER_EVENT --> userEventConsumer: Message event flowuserEventConsumer --> users: keep users updatedscheduler --> POST_calculations: trigger calculationPOST_calculations --> calculator: calculate scorescalculator --> scores: store scoresUser -> GET_scores: get scoresGET_scores --> GET_calculated_scores: get scoresGET_calculated_scores --> scoreService: get scoresscoreService --> scores: get scores@enduml
Flavors
GitHub flavored
- Task lists
- - [x] completed- [ ] in progress
- Emojis
- :tada:
- Task lists
Gitlab flavored
Task lists
- - [x] completed- [~] inapplicable- [ ] in progress
- :tada:
Table of content
- [[_TOC_]]
Miscellaneous
Front matter
It is metadata placed at the beginning of the file before the content. This data can be used by static site generators like Gatsby or blogging platforms like dev.to.
---title: Markdown overviewpublished: truetags: ['markdown']cover_image: https://picsum.photos/200/300canonical_url: https://sevic.dev/notes/markdown-overview/---
Mdx
Allows using JSX in Markdown documents.
import { Dashboard } from './dashboard.js'<Dashboard year={2023} />