mkdocs-mermaid2-plugin icon indicating copy to clipboard operation
mkdocs-mermaid2-plugin copied to clipboard

Using SuperFences causes useless log output for every single page, even ones without diagrams

Open goto-dev-null opened this issue 4 months ago • 2 comments

Prerequisite: have the SuperFences Markdown Extension enabled with a custom fence for mermaid; e.g.:

markdown_extensions:
  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:mermaid2.fence_mermaid_custom

Here is a partial of output of running mkdocs build:

Image

Here is the culprit in the code:

# first, determine if the page has diagrams:
if self.activate_custom_loader:
    # the custom loader has its specific marking
    # <pre class = 'mermaid'><code> ... </code></pre>
    info("Custom loader activated")
    mermaids = len(soup.select("pre.mermaid code"))

I humbly will suggest to remove that log line entirely; I do not see the merit in it at all, even for pages that do have mermaid graphs, because those will output their own INFO:

Image

If it absolutely must remain in, I would plead toward changing it from INFO to DEBUG. I'm not even sure if mkdocs (presently) supports specifying debug as a level, but conceptually to me, if the purpose of a log line is just to say "execution has reached this part in the code", that is a DEBUG or even a TRACE, not an INFO.

goto-dev-null avatar Sep 02 '25 21:09 goto-dev-null