Skip to content

Commit 8810220

Browse files
committed
docs: correct mermaid-py behavior in comments (remote API, not local Node.js)
mermaid-py (>=0.8.0, the version this project pins) validates diagrams by sending them to a remote rendering service (https://mermaid.ink by default, overridable via mermaid-py's own MERMAID_INK_SERVER env var), not by spawning a local Node.js subprocess. Verified by inspecting the mermaid-py 0.8.0 and 0.8.4 source directly (mermaid/__main__.py uses requests.get() against MERMAID_INK_SERVER, no subprocess/child_process anywhere). This corrects two comments that describe the old (inaccurate, or possibly just always-wrong) assumption: - codewiki/src/be/utils.py: the _MERMAID_PY_BROKEN comment - pyproject.toml: the nodejs build-requires comment No functional change. The nodejs build-requires entry itself is left as-is since I couldn't confirm whether it's needed for something else in the project; flagging it for maintainers to reconsider.
1 parent 9ed15ba commit 8810220

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

‎codewiki/src/be/utils.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,11 @@ def extract_mermaid_blocks(content: str) -> List[Tuple[int, str]]:
151151
# Skip it proactively so SpiderMonkey is never loaded into the process.
152152
_PYTHONMONKEY_BROKEN = sys.version_info >= (3, 12)
153153

154-
# mermaid-py spawns a Node.js subprocess that can hang indefinitely (e.g. when
155-
# Node.js is missing or the mermaid CLI is misconfigured). Enabled by default;
154+
# mermaid-py validates diagrams by sending them to a remote rendering service
155+
# (https://mermaid.ink by default, overridable via the MERMAID_INK_SERVER env
156+
# var understood by mermaid-py itself) rather than spawning a local Node.js
157+
# subprocess. It can still hang or fail when that service is unreachable
158+
# (no network egress, DNS/firewall issues, or an outage). Enabled by default;
156159
# set MERMAID_VALIDATE=0 to disable.
157160
_MERMAID_PY_BROKEN = os.environ.get("MERMAID_VALIDATE", "1") == "0"
158161
_MERMAID_PY_PROBED = True # Skip probing — rely on env var

‎pyproject.toml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ dependencies = [
6464
]
6565

6666
[external]
67-
# Node.js is required for mermaid-py which validates mermaid diagrams in generated documentation
67+
# NOTE: mermaid-py (>=0.8.0, the version pinned below) validates diagrams via
68+
# an HTTP call to a remote rendering service (mermaid.ink by default), not a
69+
# local Node.js process -- this nodejs requirement may no longer be needed for
70+
# that purpose specifically; kept as-is pending confirmation it isn't used
71+
# elsewhere.
6872
build-requires = [
6973
{ name = "nodejs", version = ">=14.0.0" }
7074
]

0 commit comments

Comments
 (0)