Pass parameters to codeblock

Is that possible to also cache things after ```language split by space when caching section

I’m trying to enhance code block to make able to receive param from user to determine if a specific functionality should apply, such as show line number, highlight specific line.

The way to pass parameter to code block I consider is write parameters after ```language param1 param2 ... paramN, then I use registerMarkdownPostProcessor to handle these parameter.

But I found obsidian seems cached something and directly ignore anything after the first space after language.Which cause my processor won’t get not be called if user change parameters.

I have considered use other separator instead of space, but it will get loss of syntax highlight.

How to listen if the element passed to processor is mounted to document?

For the functionality of line highlight, I need to know the style of code block such as clienttop, lineHeight, etc. which is only possible to know after the code block section has mounted to document. Is there a hook I could use to do that?

1 Like

This relates to Postprocessor does not process changes after codeblock language.