Last active
May 8, 2025 16:40
-
-
Save dr2050/21b3d7966cc7a0c3056d0776ff7ab8dd to your computer and use it in GitHub Desktop.
Convert all Mermaid Markdown files (mermaid-*.md) to jpg with white background.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def convert_mermaid_md_to_jpg | |
Dir["mermaid-*.md"].each do |f| | |
slug = f["mermaid-".length...f.length-".md".length] | |
command = "~/node_modules/.bin/mmdc -i mermaid-#{slug}.md -o mermaid-#{slug}.png -b '#FFFFFF'" | |
puts "Converting mermaid-#{slug}.md to mermaid-#{slug}.png" | |
`#{command}` | |
end | |
end | |
if __FILE__ == $0 | |
puts "Converts files matching mermaid-*.md to mermaid-*.png" | |
puts "If this fails you might need to run:" | |
puts "cd ~ && npm install mermaid.cli && popd" | |
convert_mermaid_md_to_jpg | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
flowchart TD
%% Define custom styles with high contrast colors
classDef mainConcept fill:#FF1493,stroke:#000,stroke-width:2px,color:white
classDef institution fill:#4169E1,stroke:#000,stroke-width:2px,color:white
classDef dynamics fill:#228B22,stroke:#000,stroke-width:2px,color:white
classDef change fill:#8B008B,stroke:#000,stroke-width:2px,color:white