pandoc-mermaid-selenium-filter
Provides a feature available as a filter for the widely known universal document conversion tool Pandoc, which converts code blocks written in Mermaid syntax within Markdown documents into images.
Supports Architecture Diagrams introduced in Mermaid v11.1.0. Additionally, icon sets from iconify.design, including SVG Logos and Material Design Icons, are available for use.
The conversion process follows these steps:
- Detect code blocks with the
mermaidclass specified - Convert the detected Mermaid syntax code to PNG images using Selenium
- Save the generated images in the
mermaid-imagesdirectory and replace the original code blocks with image references
Although many similar filters with the same functionality are already available, most of them rely on packages using Puppeteer as the image conversion engine. These packages often face dependency issues or have challenges related to complex setup and configuration. This package adopts Selenium, which has a longer history than Puppeteer.
Usage
-
First, install the filter.
pip install pandoc-mermaid-selenium-filter
-
When using Mermaid syntax in your Markdown file, use a code block with the
mermaidclass specified as follows:# Testing Mermaid Filter Here's a simple flowchart example: ```mermaid graph TD A[Start] --> B{Condition} B -->|Yes| C[Process 1] B -->|No| D[Process 2] C --> E[End] D --> E ```
-
You can convert Markdown to HTML/PDF using the following commands:
# HTML pandoc example/example.md \ --filter pandoc-mermaid-selenium-filter \ -o example/output.html # PDF pandoc example/example.md \ --filter pandoc-mermaid-selenium-filter \ -o example/output.pdf
Architecture Diagrams
In the context of mermaid-js, the architecture diagram is used to show the relationship between services and resources commonly found within the Cloud or CI/CD deployments. In an architecture diagram, services (nodes) are connected by edges. Related services can be placed within groups to better illustrate how they are organized.
The example code as follows:
```mermaid
architecture-beta
group api(cloud)[API]
service db(database)[Database] in api
service disk1(disk)[Storage] in api
service disk2(disk)[Storage] in api
service server(server)[Server] in api
db:L -- R:server
disk1:T -- B:server
disk2:T -- B:db
```
Icons
By default, architecture diagram supports the following icons: cloud, database, disk, internet, server. This package provides access to the SVG Logos and Material Design Icons icon sets offered by iconify.design. They can be used in the architecture diagram by using the format logos:icon-name or mdi:icon-name.
The example code will change as follows:
```mermaid
architecture-beta
group api(logos:aws-lambda)[API]
service db(logos:aws-aurora)[Database] in api
service disk1(logos:aws-glacier)[Storage] in api
service disk2(logos:aws-s3)[Storage] in api
service server(logos:aws-ec2)[Server] in api
db:L -- R:server
disk1:T -- B:server
disk2:T -- B:db
```
Developer Information
Development Environment Setup
You can install all development dependencies with the following command:
uv sync --extra dev
Build
You can build this package using the following command. During the build process, the custom hooks will download the latest source code for Mermaid, as well as the SVG Logos and Material Design Icons icon sets, from jsDelivr.
uv build
Testing
You can run tests with the following command:
uv run pytest
License
This library is licensed under the MIT License.
Metadata
Release files for pandoc-mermaid-selenium-filter 1.0.1
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 | Actions |
|---|---|---|---|---|
| pandoc_mermaid_selenium_filter-1.0.1.tar.gz | 4.2 MB | Without provenance | Details for pandoc_mermaid_selenium_filter-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pandoc_mermaid_selenium_filter-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for pandoc_mermaid_selenium_filter-1.0.1-py3-none-any.whl |
Total release size: 8.3 MB
Release files / pandoc_mermaid_selenium_filter-1.0.1.tar.gz
| Download URL | pandoc_mermaid_selenium_filter-1.0.1.tar.gz |
|---|---|
| Size | 4.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c5947c2b1dace5c85e1d2cd95f704223514f7bcfe115501315f3f2c63f88c4f
|
|
BLAKE2b-256 checksum How to use checksums |
b09ea68ee97cd0f8342012929e73a84cd4b5b0c6ea7ba32f54259bac51337346
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.5.24
|
Release files / pandoc_mermaid_selenium_filter-1.0.1-py3-none-any.whl
| Download URL | pandoc_mermaid_selenium_filter-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1423491d364de75ce33f136f425241260e7d28ae5db7739a279c5bce7b125fef
|
|
BLAKE2b-256 checksum How to use checksums |
a85c1e90475f08fb0305fe8a3ee155a240832867c197f2b39128d942ae1ddc5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.5.24
|
Security for pandoc-mermaid-selenium-filter 1.0.1
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.