-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using SuperFences custom fences #618
Comments
|
There is no reason to setup flow as it is already set up for you, but if you did need to setup your own, you have to remember that SuperFences takes a function references, not a string with the function name. And you have to reference it with the full import path. So the function you specified up above markdown_extensions:
- pymdownx.superfences:
custom_fences:
- name: flow
class: uml-flowchart
format: !!python/name:pymdownx.superfences.fence_code_format You can see examples in pymdownx-extensions document config file of me referencing functions for other extensions. |
Perfect! Thanks for your help. |
No problem. Glad you got it working. |
This doesnt seem to work for me. I have tried the code in your demo:
and this is what my yml looks like
|
@harveyslash, you are going to have to read the documentation as I feel like it is explained in pretty good depth there. One thing it mentions is that even after adding the required libraries, you need to have a loader script, and then I give and example loader script: https://facelessuser.github.io/pymdown-extensions/extensions/superfences/#uml-diagram-example. Also, if you read through this post, I mention that by default, Please read through this post and pymdown-extensions' documentation as most of your question should be answered. If you have a specific question about the information covered in the documentation, or feel there is wrong or incomplete information, please open an issue over at pymdown-extensions, and it can be discussed over there. |
I am not sure about what you mean by already set up. I created a js file like this:
Then I reference it in my yml like this:
My config looks like :
It still does not show up. |
It turns out that there is a syntax error in the example. This made it work.
|
Okay, so it looks like I had a stray What I'm actually using is this: https://github.com/facelessuser/pymdown-extensions/blob/master/docs/src/js/uml.js, which gets converted to normal JS. Most likely I ran it through a converter, cleaned it up, and when I made changes to the original source, I quickly patched the example and made the mistake. Anyways, thanks for catching that, I'll fix it in the docs. |
This has nothing to do with SuperFences. The 3rd party libraries render the diagrams, Material handles the styling of them. If the diagram is large, yes it will overflow. At the very least, it should be scrollable. If it isn't, then maybe Material needs to update the styling. I do know that I am personally adding these additional styles to UML: https://github.com/facelessuser/pymdown-extensions/blob/master/docs/src/scss/_uml.scss. Maybe that will help. I added them at one point to fix an issue I had, but I am not sure if they are still relevant. If you are concerned that the loader script is doing something wrong, feel free to write a better one. My intention is to provide an example that works, which it does. I am not specifically maintaining a JavaScript loader library, but a pull request to provide a better one is fine if someone wants to do the work. With that said though, I am using the example albeit in a slightly different form, but functional it is the same, and I haven't noticed any issues with it. I would play with your UML styling to get what you want. If you find there is some additional styling that Material needs to style them better, then I'd create a styling issue here or a pull request. Maybe the additional styling I use will help. I've been meaning to look into that area more on the Material side, but I support a bunch of repos, and priority pulls me away from things like this at times. |
Updated doc example to fix typo and made the example a little more generic. |
To make the config work on my side, I have to remove the '-' prepending 'class' & 'format'
|
Description
I know I can enable SuperFences for enabled nested blocks. Is it possible to enable custom fences (like flow and sequence) using the mkdocs-material theme?
Expected behavior
Ideally a mkdoc.yml file with the following would enable a custom flow fence
This could either automatically include raphael.js and flowchart.js (required as documented in the SuperFences docs) or I could add them to
custom_javascript
.Actual behavior
ERROR - Config value: 'markdown_extensions'. Error: Invalid Markdown Extensions configuration
Steps to reproduce the bug
mkdocs build
ormkdocs serve
Package versions
Python 2.7.10
mkdocs, version 0.16.3
Version: 1.12.2
Project configuration
System information
The text was updated successfully, but these errors were encountered: