Skip to content

Error with custom_fences fence_mermaid_custom function #113

Open
@GeneralZero

Description

I am trying to build my documentation with mkdocs. And keep running in to this error.

Looking into the plugin.py script the _activate_custom_loader function doesn't exist.

DEBUG   -  Building page Mobile/Android/Safety Net.md
DEBUG   -  Running `page_context` event from plugin 'material/search'
DEBUG   -  Running `post_page` event from plugin 'mermaid2'
INFO    -  MERMAID2  - Found superfences config: {'preserve_tabs': True, 'custom_fences': [{'name': 'math', 'class': 'arithmatex', 'format': functools.partial(<function _fence_generic_format at 0x7bc1f9c11c60>, tag='div')}, {'name': 'latex', 'class': 'arithmatex', 'format': functools.partial(<function _fence_generic_format at 0x7bc1f9c11c60>, tag='div'), 'kwds': {'mode': 'generic', 'tag': 'pre'}}, {'name': 'mermaid', 'class': 'mermaid', 'format': functools.partial(<function fence_mermaid at 0x7bc1f99d72e0>, custom=True)}, {'name': 'tree', 'class': 'tree', 'format': <function fence_div_format at 0x7bc1f99e4400>}, {'name': 'ghostscript', 'class': 'tree', 'format': <function fence_div_format at 0x7bc1f99e4400>}, {'name': 'table', 'class': 'table', 'format': <function fence_table_format at 0x7bc1f99e6160>}]}
ERROR   -  Error building page 'Mobile/Android/Safety Net.md': 'functools.partial' object has no attribute '__name__'
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/mermaid2/plugin.py", line 159, in activate_custom_loader
    return self._activate_custom_loader
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'MarkdownMermaidPlugin' object has no attribute '_activate_custom_loader'. Did you mean: 'activate_custom_loader'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
             ~~~^^
  File "/usr/local/lib/python3.13/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.13/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/mkdocs/__main__.py", line 288, in build_command
    build.build(cfg, dirty=not clean)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/mkdocs/commands/build.py", line 337, in build
    _build_page(
    ~~~~~~~~~~~^
        file.page, config, doc_files, nav, env, dirty, excluded=file.inclusion.is_excluded()
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/mkdocs/commands/build.py", line 226, in _build_page
    output = config.plugins.on_post_page(output, page=page, config=config)
  File "/usr/local/lib/python3.13/site-packages/mkdocs/plugins.py", line 646, in on_post_page
    return self.run_event('post_page', output, page=page, config=config)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/mkdocs/plugins.py", line 566, in run_event
    result = method(item, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/mermaid2/plugin.py", line 233, in on_post_page
    if self.activate_custom_loader:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/mermaid2/plugin.py", line 181, in activate_custom_loader
    if format_fn.__name__ == CUSTOM_FENCE_FN:
       ^^^^^^^^^^^^^^^^^^
AttributeError: 'functools.partial' object has no attribute '__name__'. Did you mean: '__ne__'?
The command '/bin/sh -c PYTHONPATH=/opt/MemoryViewer mkdocs build -v' returned a non-zero code: 1

Metadata

Assignees

No one assigned

    Labels

    environmentEnviropnment issue (libraries, etc.)resolvedThe question was resolveduseful tipContains a useful tip to solve the issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions