From bb41868a8b73ba9df853a0b0e0663faecbc15e69 Mon Sep 17 00:00:00 2001 From: Laurent Franceschetti Date: Wed, 15 Apr 2020 13:00:42 +0200 Subject: [PATCH] Initial modifications to plugin - Compatibility with python3 (return str instead of unicode) - Update and complete the README.md --- LICENSE | 2 +- README.md | 51 ++++++++++++++++++++++++++++++++++++++++++--------- setup.py | 20 ++++++++++++-------- 3 files changed, 55 insertions(+), 18 deletions(-) diff --git a/LICENSE b/LICENSE index e66ef37..f061bad 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018 PuGong +Copyright (c) 2018 PuGong -- 2020, others Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 228757e..78e642d 100755 --- a/README.md +++ b/README.md @@ -1,33 +1,66 @@ # mkdocs-markdownextradata-plugin -A MkDocs plugin that render meraid graph to mermaid style +A MkDocs plugin that renders mermaid graph to mermaid style. +> This is a fork from Pugong Liu's excellent project, +> which is no longer maintained." -## Installation +## Installation +### Automatic Install the package with pip: ```bash -pip install mkdocs-mermaid-plugin +pip install mkdocs-mermaid-plugin2 ``` -## Usage +### Manual +Clone this repository: + +```bash +python setup.py install +``` -Enable this plugin in your `mkdocs.yml`: +## Installation + +To enable this plugin, you need to declare it in your config file +(`mkdocs.yml`). + +In order to work, the plugin also requires the +[mermaid](https://www.npmjs.com/package/mermaid) javascript +library (in the exemple below, it fetched from the last version +from the [unpkg](https://unpkg.com/) repository; change the version +no as needed). ```yaml plugins: - - markdownmermaid + - markdownmermaid2 extra_javascript: - - https://unpkg.com/mermaid@7.1.2/dist/mermaid.min.js + - https://unpkg.com/mermaid@8.5.0/dist/mermaid.min.js ``` > **Note:** Don't forget to include the mermaid.min.js (local or remotely) in your `mkdocs.yml` -More information about plugins in the [MkDocs documentation][mkdocs-plugins] + +## Usage + +### General Principle +In order to insert a mermaid diagram, simply insert the diagram, +preceded by the language: + ```mermaid + graph TD + A[Client] --> B[Load Balancer] + B --> C[Server01] + B --> D[Server02] + ``` -[mkdocs-plugins]: http://www.mkdocs.org/user-guide/plugins/ \ No newline at end of file +### How to write Mermaid diagrams +* For instructions on how to make a diagram, see + [the official website](https://mermaid-js.github.io/mermaid/#/). +* If you are not familiar, see the [n00bs' introduction to mermaid](https://mermaid-js.github.io/mermaid/#/n00b-overview). +* In case of doubt, you will want to test your diagrams in the + [Mermaid Live Editor](https://mermaid-js.github.io/mermaid-live-editor). diff --git a/setup.py b/setup.py index f0beb7e..8c0177b 100755 --- a/setup.py +++ b/setup.py @@ -2,25 +2,29 @@ from setuptools import setup, find_packages +VERSION = '0.1.2' + def readme(): """print long description""" with open('README.md') as f: return f.read() long_description = ( - "This is a mkdocs plugin that could enable the mermaid graph in the markdown file." - "Please follow the instruction in reame to enable this plugin" + "A mkdocs plugin that interprets mermaid graphs in the markdown file." + "To install, please follow instructions in the readme file." + "This is a fork of the Pugong Liu's excellent project, " + "which is no longer maintained." ) setup( - name='mkdocs-mermaid-plugin', - version='0.1.1', - description='A MkDocs plugin that support mermaid graph in markdown file', + name='mkdocs-mermaid-plugin2', + version=VERSION, + description='A MkDocs plugin for including mermaid graphs in markdown sources', long_description=long_description, keywords='mkdocs python markdown mermaid', url='https://github.com/pugong/mkdocs-mermaid-plugin', - author='pugong', - author_email='pugong.liu@gmail.com', + author='pugong, Fralau', + author_email='pugong.liu@gmail.com, fralau2035@yahoo.com', license='MIT', python_requires='>=2.7', install_requires=[ @@ -43,7 +47,7 @@ def readme(): packages=find_packages(exclude=['*.tests']), entry_points={ 'mkdocs.plugins': [ - 'markdownmermaid = markdownmermaid.plugin:MarkdownMermaidPlugin' + 'markdownmermaid2 = markdownmermaid.plugin:MarkdownMermaidPlugin' ] } )