facelessuser / pymdown-extensions

Extensions for Python Markdown
https://facelessuser.github.io/pymdown-extensions/
Other
963 stars 254 forks source link

cannot find module 'tools.pymdownx_md_render' during the serve document process #1446

Closed Dup4 closed 3 years ago

Dup4 commented 3 years ago

I try to clone the repo and build documents locally.

Follow this tutorial as follows:

image

But I failed, the following is my operation process:

asciicast

I try to find the source of the problem.

In mkdocs.yml , need a function named tools.pymdownx_md_render.md_sub_render, the function is located in the tools/pymdownx_md_render.py.

But the tools directory is excluded in setup.py.

Therefore, if we only install the pymdown-extensions, the function will not be included.

So I am particularly curious, how did you build the documents for this repo.

facelessuser commented 3 years ago

Because I'm running some code directly from tools you need to the do the following:

python3 -m mkdocs serve

That will include the CWD directory so that the "tools" module will be found.

Dup4 commented 3 years ago

Because I'm running some code directly from tools you need to the do the following:

python3 -m mkdocs serve

That will include the CWD directory so that the "tools" module will be found.

It works. Thank you.

SPyofgame200 commented 6 months ago

Why cant I use md-render ?

image

PS C:\Users\Admin\source\repos\es.ac.vn> python3 -m mkdocs serve
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
PS C:\Users\Admin\source\repos\es.ac.vn> python -m mkdocs serve
Error: MkDocs encountered an error parsing the configuration file: while constructing a Python object
cannot find module 'tools.pymdownx_md_render' (No module named 'tools.pymdownx_md_render')
  in "C:\Users\Admin\source\repos\es.ac.vn\mkdocs.yml", line 1266, column 19
markdown_extensions:
  - markdown.extensions.abbr
  - markdown.extensions.attr_list
  - markdown.extensions.def_list
  - markdown.extensions.tables
  - markdown.extensions.footnotes
  - markdown.extensions.md_in_html
  - markdown.extensions.admonition
  - markdown.extensions.smarty:
      smart_quotes: false
  - markdown.extensions.toc:
      permalink: ⚓︎
      title: Mục lục
      toc_depth: 4
      permalink_title: Click để đánh dấu trang ⚓︎
      slugify: !!python/object/apply:pymdownx.slugs.slugify
        kwds:
          case: lower
  - pymdownx.arithmatex:
      generic: true
  - pymdownx.betterem:
      smart_enable: all
  - pymdownx.caret
  - pymdownx.mark
  - pymdownx.tilde
  - pymdownx.details
  - pymdownx.critic:
      mode: view
  - pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji 
      emoji_generator: !!python/name:materialx.emoji.to_svg
      options:
        custom_icons:
          - assets/.icons
  - pymdownx.highlight:
      anchor_linenums: true
      use_pygments: true
      auto_title: true
      linenums: true
      line_spans: __span
      linenums_style: pymdownx-inline
      pygments_lang_class: true
  - pymdownx.inlinehilite
  - pymdownx.keys
  - pymdownx.smartsymbols
  - pymdownx.snippets
  - pymdownx.superfences:
      preserve_tabs: true
      custom_fences:
        - name: python
          class: python
          validator: !!python/name:markdown_exec.validator
          format: !!python/name:markdown_exec.formatter
        - name: mermaid
          class: mermaid
          format: !!python/name:pymdownx.superfences.fence_code_format
        - name: vegalite
          class: vegalite
          format: !!python/name:mkdocs_charts_plugin.fences.fence_vegalite
        - name: diagram
          class: diagram
          format: !!python/name:pymdownx.superfences.fence_code_format
        - name: math
          class: arithmatex
          format: !!python/object/apply:pymdownx.arithmatex.arithmatex_fenced_format {kwds: {mode: generic, tag: pre}}
        - name: md-render
          class: md-render
          format: !!python/name:tools.pymdownx_md_render.md_sub_render
  - pymdownx.tabbed:
      alternate_style: true
      slugify: !!python/object/apply:pymdownx.slugs.slugify
        kwds:
          case: lower
  - pymdownx.tasklist:
      custom_checkbox: true
      clickable_checkbox: true
  - pymdownx.progressbar
  - pymdownx.blocks.tab
facelessuser commented 6 months ago

I do not ship pymdownx_md_render in pymdown-extensions. It is only used for my documentation, so you cannot access it simply by installing pymdown-extensions.

I have no idea what you are doing or how your project is organized. Based on the error, I can only assume you did not copy my personal, custom script into your project.

Keep in mind that I do not provide support for my own personal scripts that I do not document and do not include in the released package. You use them at your own risk and are often left to figure out how to use them yourself.

SPyofgame200 commented 6 months ago

Oh, as I failed to make the progress bar no matter how I tried with custom js and custom CSS, so I thought I was missing some features from your code

SPyofgame200 commented 6 months ago

Also the collapsible block feature (which I really want to have), hmmmmmm, it isn't render as expected right now

facelessuser commented 6 months ago

Anything in this project's tool folder you can copy into your project as it is all licensed under MIT. Currently, I have not opted to officially support anything in the tool folder and distribute them in any of my releases.

You are free to copy the files from tools to your project and adapt them as required. I provide no documentation and do not provide any support currently for them.

I am not exactly sure what you are referring to when you mention "collapsible" blocks. If you are talking about Details, we have to different extensions that can handle that. If you are talking about my custom script in the tools folder to provide collapsible code blocks, those are undocumented and unsupported, but they will require custom CSS.

SPyofgame200 commented 6 months ago

I thought Progressbar has its own documentation, but there are issues related to it ?

facelessuser commented 6 months ago

If you have an issue with progressbar, please open a new issue and provide a reproducible example and explain your issue.

facelessuser commented 6 months ago

What you've linked is an issue about material not providing CSS for progressbar. If it doesn't provide CSS, you have to provide your own.