diff --git a/README.md b/README.md index ea61adf..d3c6577 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,74 @@ # md_mermaid -mermaid extension to add support for mermaid graph inside markdown file +mermaid extension for Python-Markdown to add support for mermaid graph inside markdown file + +## Installation + +* pip (only python version >=3.x) : + +~~~shell +pip install markdown +pip install md-mermaid +~~~ + +## Usage + +In your python script : + +~~~python +import markdown + +text = """ +# Title + +Some text. + +​~~~mermaid +graph TB +A --> B +B --> C +​~~~ + +Some other text. + +​~~~mermaid +graph TB +D --> E +E --> F +​~~~ +""" + +html = markdown.markdown(text, extensions=['md_mermaid']) + +print(html) +~~~ + +Output will result in : + +~~~html +

Title

+

Some text.

+
+graph TB +A --> B +B --> C +
+ +

Some other text.

+
+graph TB +D --> E +E --> F +
+ + + +~~~ + +The `` line appears only once even if there are several graphs in the file. + +> Note that the extension name have a '_' not a '-'. + +> Attention : don't forget to include in your output html project the two following mermaid files : +> +> * mermaid.css (optional, can be customised) +> * mermaid.min.js (can be download here [here](https://unpkg.com/mermaid@8.1.0/dist/)) \ No newline at end of file diff --git a/md_mermaid.py b/md_mermaid.py index 8a8f19f..a71a964 100644 --- a/md_mermaid.py +++ b/md_mermaid.py @@ -6,7 +6,7 @@ Original code Copyright 2018-2020 [Olivier Ruelle]. -License: [BSD](http://www.opensource.org/licenses/bsd-license.php) +License: GNU GPLv3 """ @@ -54,7 +54,7 @@ def run(self, lines): elif in_mermaid_code: new_lines.append(line.strip()) else: - + new_lines.append(line) old_line = line @@ -79,4 +79,3 @@ def extendMarkdown(self, md, md_globals): def makeExtension(**kwargs): # pragma: no cover return MermaidExtension(**kwargs) - diff --git a/setup.py b/setup.py index 1a1c354..7f8f50a 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name='md_mermaid', - version='0.1.1', + version='0.1.0', author='Olivier Ruelle', author_email='olivier.ruelle@yahoo.com', description='Python-Markdown extension to add support for mermaid graph inside markdown file.',