What is Markdown Format
What is Markdown Format? Markdown is a lightweight markup language based on text that provides a syntax for easily formatting documents. Markdown is especially convenient for writing documents and blog posts on the web. It allows you to write in plain text format and later convert it into various other formats such as HTML, making it versatile for a wide range of applications.
Markdown provides a simple way to work with various elements like headings, lists, bullet points, emphasis, italics, links, images, quotes, code blocks, and more, all using straightforward symbols.
Tree structure
Therefore, I believe that Markdown can be represented in a tree structure due to its inherent structure. For example, within Markdown, the ## tag, which represents smaller text than the # tag, belongs to it.
When it comes to have below markdown file.
# Convert Markdown to Tree (Dictonary)
This module is going to convert markdown(.md) file into tree-structure-object.
The tree object will be exported as treelib, which is defined on this repository (<https://github.com/caesar0301/treelib>)
## Set Up
```bash
poetry add git+https://github.com/kevin-tofu/md2tree.git
```
## Usage
### Functions
| Functions | Description |
| --- | --- |
| file2tree | |
| lines2tree | |
| tree2dict | |
| tree2file | |
And it shows like below when we see it thru html. (This markdown page is a README.md on my repository.)
Convert Markdown to Tree (Dictonary)
This module is going to convert markdown(.md) file into tree-structure-object. The tree object will be exported as treelib, which is defined on this repository (https://github.com/caesar0301/treelib)
Set Up
poetry add git+https://github.com/kevin-tofu/md2tree.git
Usage
Functions
Functions | Description |
---|---|
file2tree | |
lines2tree | |
tree2dict | |
tree2file |
Markdown2Tree Conversion
I coeded a library that converts markdown files into tree structure.
https://github.com/kevin-tofu/md2tree
This markdown is converted into tree structure like this using this library.
root
└── Convert Markdown to Tree (Dictonary)
├── Set Up
└── Usage
└── Functions
Exports Tree Structure as JSON file
And actually, each headings have texts as elements. So, we can see and visualize what texts these headings have. For example, the library enables us to export this tree structure as json file.
{
"name": "root",
"data": null,
"children": [
{
"name": "1",
"data": {
"title": "Convert Markdown to Tree (Dictonary)",
"texts": [
"\n",
" This module is going to convert markdown(.md) file into tree-structure-object.\n",
"\n"
]
},
...