nielsvaneck / render-md-mermaid Goto Github PK
View Code? Open in Web Editor NEWGitHub Action & Utility for rendering Mermaid-JS diagrams in Markdown files for display on GitHub
License: Apache License 2.0
GitHub Action & Utility for rendering Mermaid-JS diagrams in Markdown files for display on GitHub
License: Apache License 2.0
The example on the page, even when providing a valid path runs but says "nothing to commit" in the logs on the auto-commit-action.
Is this maintained? v2 doesn't really work, as bash is not present and whole thing crashes. Any hope for an update?
My repository structure is like below:
...
on:
push:
paths:
- child1/**
jobs:
render-md-mermaid:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./child1 # not working
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Render images for every Mermaid diagram in all Markdown files (*.md) in the repo
uses: nielsvaneck/render-md-mermaid@v1
- name: Commit rendered png and svg files
uses: stefanzweifel/git-auto-commit-action@v4
with:
repository: ./child1/images
commit_message: automatically rendered mermaid diagrams
Is there a solution to have a specific working directory with args?
I tried to clone your git repository and change shell find script in 'render-md-mermaid.mk'.
The action works successful but didn't create png and svg.
On my first workflow run, I got this error:
env: can't execute 'bash': No such file or directory
...probably because something could have changed in the mermaid-js latest docker image that this project uses as base image.
I was able to resolve it by installing bash and perl in my fork.
.
Without a license, the code follows standard copyright which prevents copying or making derivative works. Without a license, there are some corporate entities that can not use this action.
Adding a license can be done right from the Github UI:
https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-license-to-a-repository
Files will be updated by the workflow even if there is no change on the mermaid diagram.
Problem here is the unix timestamp is included in the SVG style tag:
- <style>#mermaid-1672838800238
+ <style>#mermaid-1672838865273
This will result in changed SVG files even if there is no actual change.
A commit should then not be triggered.
One approach would be to use sed
and the #mermaid-
name could be unified and replaced?
if [[ "$image_file" =~ ^.*\.svg$ ]]; then
sed -i.bak -e 's/<br>/<br\/>/g' $image_file
+ sed -i -e 's/mermaid-[0-9]*/mermaid/g' $image_file
fi
I guess the mermaid-cli does not have the option:
$ ./node_modules/.bin/mmdc -h
Usage: mmdc [options]
Options:
-V, --version output the version number
-t, --theme [theme] Theme of the chart (choices: "default", "forest", "dark", "neutral", default: "default")
-w, --width [width] Width of the page (default: 800)
-H, --height [height] Height of the page (default: 600)
-i, --input <input> Input mermaid file. Files ending in .md will be treated as Markdown and all charts (e.g. ```mermaid (...)```) will be extracted and generated. Required.
-o, --output [output] Output file. It should be either md, svg, png or pdf. Optional. Default: input + ".svg"
-e, --outputFormat [format] Output format for the generated image. (choices: "svg", "png", "pdf", default: Loaded from the output file extension)
-b, --backgroundColor [backgroundColor] Background color for pngs/svgs (not pdfs). Example: transparent, red, '#F0F0F0'. (default: "white")
-c, --configFile [configFile] JSON configuration file for mermaid.
-C, --cssFile [cssFile] CSS file for the page.
-s, --scale [scale] Puppeteer scale factor (default: 1)
-f, --pdfFit [pdfFit] Scale PDF to fit chart
-q, --quiet Suppress log output
-p --puppeteerConfigFile [puppeteerConfigFile] JSON configuration file for puppeteer.
-h, --help display help for command
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.