markdown-mermaid-to-images
A CLI tool for publishing markdown articles to dev.to. The tool will also update articles if they already exist on dev.to. It matches articles based on title in the frontmatter.
> Info: You will need to have pandoc preinstalled <https://pandoc.org/installing.html>_ for this script to work correctly. Or you can use the Docker image instead.
Usage
pip install markdown-mermaid-to-images
markdown_mermaid_to_images --help
Usage: markdown_mermaid_to_images [OPTIONS]
Exports mermaid diagrams in Markdown documents as images.
- Options:
- -m, --file PATH
Path to markdown file, where the mermaid code blocks will be converted to images.
- -f, --folder PATH
Path to folder where we will convert all markdown mermaid code blocks to images.
- -i, --ignore PATH
Path to folder to ignore, markdown files in this folder will not be converted.
- -o, --output PATH
Path to folder where to save the new markdown files. [required]
- -l, --log-level
[DEBUG|INFO|ERROR] Log level for the script.
- --help
Show this message and exit.
$ markdown_mermaid_to_images -f tests/data -o tests/data/output/ -i tests/data/another_folder
Docker Image
You can also use the Docker image that comes with all the dependencies preinstalled. In this example you can find the output in tests/data/output on your host machine.
$ docker run -v ${PWD}/tests/data/another_folder:/data/input -v ${PWD}/tests/data/output:/data/output test
Example Markdown File
Where an example markdown file may look something like this. The meramid code blocks must be surrounded by three ` and have the class mermaid.
## Introduction
Example Document
## Heading
```mermaid
%% Image: image_name
graph LR;
A --> B;
```
> INFO: Info
```mermaid
graph LR;
A --> B
B --> C
subgraph 1;
subgraph 2;
C --> D;
end
end;
```
This will then get converted into a file that looks like
Introduction
------------
Example Document
Heading
-------

> INFO: Info

GitLab CI
You can use also use this in your CI/CD with the provided Docker image. Below is an example .gitlab-ci.yml file, you may wish to use or include. The advantage of this is you can publish your aritcles using CI/CD.
stages:
- pre-publish
convert-mermaid:markdown:
image: registry.gitlab.com/hmajid2301/markdown-mermaid-to-images
stage: pre-publish
script:
- markdown_mermaid_to_images --folder tests/data --ignore tests/data/another_folder --output tests/data/output
Setup Development Environment
git clone git@gitlab.com:hmajid2301/markdown-mermaid-to-images.git
cd markdown-mermaid-to-images
pip install tox
make install-venv
source .venv/bin/activate
make install-dev
Changelog
You can find the changelog here.
Appendix
Docker Image inspired by sc250024.
Metadata
Release files for markdown-mermaid-to-images 0.3.0.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| markdown-mermaid-to-images-0.3.0.post1.tar.gz | 10.4 kB | Without provenance | Details |
Release files / markdown-mermaid-to-images-0.3.0.post1.tar.gz
| Download URL | markdown-mermaid-to-images-0.3.0.post1.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1ad58638e6379c689108d7f8d7bcd67a2b6cac148a3a17a57742c802136500b3
|
|
BLAKE2b-256 checksum How to use checksums |
fde8552276e2c7ad0ef9ec35625707999c99442e6a89e5f7ae5ba9d427993bc0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12
|
Security for markdown-mermaid-to-images 0.3.0.post1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.