Skip to content
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

Could we make syntax highlighting work for Preview mode, too? #8

Closed
odiferousmint opened this issue Nov 20, 2020 · 3 comments
Closed

Could we make syntax highlighting work for Preview mode, too? #8

odiferousmint opened this issue Nov 20, 2020 · 3 comments

Comments

@odiferousmint
Copy link

@odiferousmint odiferousmint commented Nov 20, 2020

Hello.

Obsidian has some missing languages, but this plugin does not, for example: Forth. Is it possible to override Obsidian's default syntax highlighting in Preview mode with your plugin?

Or if you know how to add Forth to Obsidian's syntax highlighting, that would be much appreciated. I think they use CodeMirror, but CodeMirror supports Forth though.

@odiferousmint odiferousmint changed the title Syntax highlighting does NOT work in Preview mode for some languages Could we make syntax highlighting work for Preview mode, too? Nov 20, 2020
@deathau
Copy link
Owner

@deathau deathau commented Nov 21, 2020

This plugin only affects the syntax highlighting in the editor (which does use CodeMirror)

The preview uses a different thing: prism.js.

CodeMirror is great for editing, but in the preview where editing is not required, prism is much lighter (at least I assume that's why it uses something different). There could be the possibility of adding more modes to prism, but not something I've looked into.

@odiferousmint
Copy link
Author

@odiferousmint odiferousmint commented Nov 23, 2020

Ah I see. Do you have any idea how to add more languages to prism.js? Forth is missing. :/

@deathau
Copy link
Owner

@deathau deathau commented Nov 23, 2020

Prism has requests for new languages on their github: https://github.com/PrismJS/prism/issues?q=is%3Aissue+is%3Aopen+label%3A%22new+language%22+

If you knew what you were doing you could probably write one and submit a PR to prism (then ask Licat to pull the latest 😉). But defining syntax highlighting looks like too much regex for my brain to handle (plus I'm not familiar with Forth)

@deathau deathau closed this Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants