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

Configure CodeMirror to treat dataviewjs as javascript #2329

Merged
merged 3 commits into from
May 26, 2024

Conversation

mnaoumov
Copy link
Contributor

Fixes #566

@Riffaells
Copy link

This works, thank you

@chrisgrieser
Copy link
Contributor

chrisgrieser commented May 16, 2024

Can also confirm that this works nicely. Thank you!

src/main.ts Outdated
@@ -161,6 +161,11 @@ export default class DataviewPlugin extends Plugin {
});
})
);

window.CodeMirror.defineMode("dataviewjs", config => window.CodeMirror.getMode(config, "javascript"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth noting that the codeblock-language should not be hardcoded, as the user can change it in the dataview settings (at least in theory, don't think there is a real reason to do so though)
Pasted image 2024-05-16 at 16 16 52

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a very valid point. I'll make a fix for that

@blacksmithgu
Copy link
Owner

Neat!

@blacksmithgu blacksmithgu merged commit 61291ae into blacksmithgu:master May 26, 2024
3 checks passed
@Riffaells
Copy link

hooray

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make obsidian syntax highlight dataviejs codeblocks
4 participants