-
Open your favorite Mardown editor and start a new document.
-
Add a YAML header (yaml front matter) with :
-
titleThe title (first level heading #) of your document -
keywordsTo indicate the desired output(s)choose at less one of : output.document , output.slides, output.note
-
langTo indicate the language of the document (ie : en-EN, fr-FR) -
authorAuthor of this document. It should be an array
-
subtitle : should be added in the end of title (separated by
:)
Example:
---
title: 'My document: a subtitle'
keywords: [keyword1, output.document, output.slides]
lang: en-EN
author: DocsAsCode
---
your document body
- Write your document
Because
titleis always set in header, first level heading (#) must not be used
- Build your document
docker run --rm -it -v <your directory>:/documents/ docascod/docsascode build <your document>.md<your document>.md and its dependencies (images, source) must be located in <your directory>
Markdown syntax is wonderful because of its simplicity. But when you write a professional document you need some advanced features !
Markdown syntax does not allow to insert page break, but when you write slides you need it !
So, to set a page break you can use <<<
content before page break
<<<
content after page breakSometimes you want to highlight some text block (tip, warning ...). Mardown does not allow to do that easily !
You can use this syntax :
NOTE: Just a note...
TIP: Pro tip...
IMPORTANT: Don't forget...
WARNING: Watch out for...
CAUTION: Ensure that...In Markdown you can add image from url or path and ... that's all !! If you want to align or resize it, you must use html but it's not standard.
So, now you can :
-
horizontally align your image on
left,rightorcenter:
-
resize your image :

-
add a caption (legend) after your image :

All options can be combined (with alternative text):
You can insert block of code in Mardown and specify language to highlight.
Also now, you can :
-
Add callout (comment on lines)
```json { "key1": "value", <1> "key2": "value2" <2> } ``` <1> comment on key1 <2> comment on key2 -
Display lines number, by adding
linenumskeyword just after language name```json,linenums { "key1": "value", "key2": "value2" } ``` -
Embed external source file
```json include::myfile.json[] ```
You can also specify to display just a piece of code :
```json include::myfile.json[lines:5..10] ```
Some diagrams syntax can be interpreted during build and replaced by its representation !!
Mermaid allows designing of Flow chart, Sequence diagrams, Class diagrams, State diagrams, Gantt, Pie and Git chart. Full syntax on https://mermaid-js.github.io
A flow chart example :
```mermaid
graph LR
A -->|Some Text| B
```Vega-lite opens the data visualization world for you. You can load external data and display : bar chart, line chart, heat map, pie, map and more. Full syntax on https://vega.github.io
A pie chart example :
```vega-lite
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": [
{"category": 1, "value": 4},
{"category": 2, "value": 6},
{"category": 3, "value": 10}
]
},
"mark": "arc",
"encoding": {
"theta": {"field": "value", "type": "quantitative"},
"color": {"field": "category", "type": "nominal"}
},
"view": {"stroke": null}
}
```PlantUML is originally specialized in UML diagrams, but it can also display Gantt, Mindmap... Full syntax : https://plantuml.com/
A sequence diagram example :
```plantuml
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
@enduml
```A special case for draw.io. We can't interpret draw.io code. But if you choose to export your diagram as png with embedded code, you can :
- display it as normal image
- edit it in draw.io
caption : YES you can have a caption after your diagram ! Add it just before diagram, must start with .
.mermaid caption
```mermaid
graph LR
A -->|Some Text| B
```
