Skip to content

feat: take just the relevant changes from #17 - #50

Draft
domWalters wants to merge 1 commit into
mermaid-clifrom
cleanup-of-#17
Draft

feat: take just the relevant changes from #17#50
domWalters wants to merge 1 commit into
mermaid-clifrom
cleanup-of-#17

Conversation

@domWalters

@domWalters domWalters commented Mar 15, 2025

Copy link
Copy Markdown
Owner

This is the parts of #17 that are actual changes for mermaid-cli without all of the deletions that made it impossible to review.

I will use this branch to review.

The one commit I created as authored by @m5c, the original PR author, and committed by me.


WARNING: This PR will not merge into mermaid-cli, I just want this to see the difference to it.

@domWalters domWalters self-assigned this Mar 15, 2025
@domWalters
domWalters changed the base branch from release-v0.9.4 to mermaid-cli March 15, 2025 16:03
Comment thread README.md

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the changes to this file can be ignored.

Comment thread mmdctest/state.mmd

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once mermaid-cli is integrated back into develop, this could be used as a simple example.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Investigate what this achieves.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Investigate what this achieves.

'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-software-rasterizer',

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably the developer needed these flags.

We should have an option for the user to define these.

I'd suggest two settings:

  • One to append to the default flags
  • One to override the default flags

image_filename = os.path.join(self.output_dir, f"diagram_{i+1}.png")

# Convert the Mermaid diagram to an image using mmdc.
command = f"mmdc -p ../puppeteer-config.json -i {mermaid_file.name} -o {image_filename} -b transparent --scale 4"

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a way to use puppeteer configs as a setting.

def render(self, html: str) -> str:
temp = NamedTemporaryFile(delete=False, suffix='.html')
try:
mermaid_regex = r'<pre class="mermaid"><code>(.*?)</code></pre>'

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty much all of this is from mermaid-cli.

Should adopt that branches version.

@domWalters domWalters added this to the v0.11.0 milestone Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants