Python function to split markdown code
Budget: €8 – €30 EUR
I want a small Python function split_markdown() to split an RMarkdown code into chapters.
Example code:
```
# This is a level 1 heading
Some text goes here.
## This is a level 2 heading
Some more text goes here. Here comes some code:
```{python}
# This is code
a = 4
a + 6 # do some calculation
```
This is a heading
=================
Even more text here.
```
Desired output: a list with three elements:
["# This is a level 1 heading
Some text goes here.
",
"## This is a level 2 heading
Some more text goes here. Here comes some code:
```{python}
# This is code
a = 4
a + 6 # do some calculation
```
",
"This is a heading
=================
Even more text here."]
It should work also for more complicated RMarkdown files.
Example code:
```
# This is a level 1 heading
Some text goes here.
## This is a level 2 heading
Some more text goes here. Here comes some code:
```{python}
# This is code
a = 4
a + 6 # do some calculation
```
This is a heading
=================
Even more text here.
```
Desired output: a list with three elements:
["# This is a level 1 heading
Some text goes here.
",
"## This is a level 2 heading
Some more text goes here. Here comes some code:
```{python}
# This is code
a = 4
a + 6 # do some calculation
```
",
"This is a heading
=================
Even more text here."]
It should work also for more complicated RMarkdown files.