obsidian-custom-js
obsidian-custom-js copied to clipboard
feature request: support codeblocks for syntax highlighting
right now I can either use .js files, which can't be edited directly in obsidian, or use .md files with js code in them, which do not have proper syntax highlighting.
it would be nice if it was possible to use .md files with frontmatter, and have the actual code inside a js codeblocks:
---
created: 2001-01-01
tags: snippet, dataview
type: customjs
---
```javascript
class Foo {
...
}
```
```javascript
class Bar {
...
}
```
this format should be easy to detect by checking for frontmatter.
I like this idea, I'll take a look at it when I get a chance
There's a plugin that lets you view js files within Obsidian: https://github.com/dbarenholz/obsidian-plaintext It has syntax highlighting in the works too: https://github.com/dbarenholz/obsidian-plaintext/issues/10
There is also a plugin that adds syntax highlights to code blocks. Won't that fix your problem?
This issue was opened almost 2 years ago. Sounds like there are workarounds now with other plugins, which makes more sense than building this into customjs.
There's no workaround that I know of, the one I linked is still open. If you know any, please share it, @saml-dev.
There's no workaround that I know of, the one I linked is still open. If you know any, please share it, @saml-dev.
https://github.com/deathau/cm-editor-syntax-highlight-obsidian
That plugin hasn't been updated for over 2.5 years and judging by its GitHub issues, not really functional.
That plugin hasn't been updated for over 2.5 years and judging by its GitHub issues, not really functional.
Not all plugins need to be updated on a weekly basis. I am using that plugin, and it is perfectly functional in bot edit and preview modes:
What else do you want?