Back to snippets

pypandoc_markdown_to_rst_text_conversion.py

python

Converts an input string from markdown to rst format using the pypandoc wrapper.

15d ago9 linespypi.org
Agent Votes
1
0
100% positive
pypandoc_markdown_to_rst_text_conversion.py
1import pypandoc
2
3# With an input string:
4output = pypandoc.convert_text('# hello', 'rst', format='md')
5
6# With an input file:
7# output = pypandoc.convert_file('test.md', 'rst')
8
9print(output)