Equal highlighting in reading mode?
I guess, this is kind of a question because this seems to be a complex one as I read in closed https://github.com/mugiwara85/CodeblockCustomizer/issues/106
The obsidian highligher in reading mode even fails to use "c++" as "cpp" etc... see images at theend
I would simply like consistency so embed notes look more similar! How about replacing the html in reading mode with an equivalent editor instance as in editor mode? TBH no real idea of the implications / complexity, but I would leave an issue open as this is the best codeblock plugin IMO.
Would also be able to keep code wrapping in both modes as questioned in https://github.com/mugiwara85/CodeblockCustomizer/issues/108 tho.
Regards!
Edit:
Read:
You mean syntax highlighting, right? I will open a wiki for this :D The editor and the reading mode are two completely differrent things. The editor is called CodeMirror, and the readingview is the generated HTML. The problem is that if you want syntax highlighting in editing mode, then it has to be provided from CodeMirror. There are a lot of languages defined, which provide the syntaxhighlight. You could add additional, but that is really complicated. You'd have to write the language parser for each specific langauge. In reading mode however the HTML gets the syntax highlighting using Prism.js. That's why they are different. Theoretically, it would possible, to achieve the same, BUT that would mean, that I had to inspect every language that Prism.js provides syntax highlighting for, and check what parts of the code are highlighted with which color. Then I had to do the same in editing mode as well, and then I could apply the Prism.js colors for the CodeMirror 6 tokens. This would take weeks, if not more, and I currently don't have the time for this. If you create a list which color to apply in editing mode for which token and which language, I am happy to include it.
You can't replace the HTML with an editor highlighted HMTL. Well, you can replace the HTML of course, since that's how the lines are created, but in reading mode you don't have access to the editor. Wait, as I am writing now, I realise that this MIGHT be possible, and that's a very big might. So IF it is, then it's the question, how does it effect performance? I will check this later.
For C++ define cpp and that works in edit and reading mode :)
Yeah I meant highlighting! Sorry for spamming your issues a fair bit too :)
You can't replace the HTML with an editor highlighted HMTL. Well, you can replace the HTML of course, since that's how the lines are created, but in reading mode you don't have access to the editor. Wait, as I am writing now, I realise that this MIGHT be possible, and that's a very big might. So IF it is, then it's the question, how does it effect performance? I will check this later.
Cool XD good luck, I suggested it as it seemed the "path" a plugin could take in order to replace it as a whole. But yeah it might be hacky. Performance wise, might be ok as the same editors are already there in editor mode.
Just like you said, manually making each language syntax match with prism.js would be a nightmare and might break / need updates so... That is probably something to request to the Obsidian team directly. Or they could take whatever approach they need but having the feature of matching syntax highlighting would be much appreciated.
Thanks for the plugin and the answers! Best regards!