Skip to content

How to obtain the content of the block in Block Extension API #2548

Closed Answered by facelessuser
CrossDark asked this question in Q&A
Discussion options

You must be logged in to vote

You likely want to use raw mode, so this should return raw IIRC: https://facelessuser.github.io/pymdown-extensions/extensions/blocks/api/#on_markdown-event.

At the on_end event, you can extract the content from the element and do whatever you want with it: https://facelessuser.github.io/pymdown-extensions/extensions/blocks/api/#on_end-event.

Keep in mind that when using raw mode, it is recommended to indent the content. This is because things like the HTML parser, which is implemented as a preprocessor can sometimes adjust the content, so indenting helps preserve the content. Raw content is expected to be indented and will be dedented by one level automatically.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by CrossDark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants