-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
feat: allow views to be in markdown files #2202
base: master
Are you sure you want to change the base?
Conversation
Kind of interesting concept, which I personally has circumvented the need of by using plugins like VSCode Editor (and partially CSS Editor, but there I've also done some extra trickery to allow that other plugin to shine). However, your code as it stands wouldn't allow for the entire range of code fences around code blocks which at least could be I reckon using the predefined sections of type "code" found in the metadataCache would be a better approach for locating and dealing with code blocks in general. This would be a safer approach, and would move some of the logic into the main Obsidian API responsible for generating those sections in the first place. See this forum post, http://forum.obsidian.md/t//77077, for a pure javascript accessing of these code sections, which should of course be translated into proper TypeScript before being included in a PR. |
I would second using the metadata cache to find the positions of the codeblocks and extract them that way - after a brief early stint, I generally try to keep my markdown parsing as tame as possible when parsing so the less dependence we have on it the better. |
I agree 100% with blacksmithgu
|
additionally I'd recommend moving the |
Just a simple change to allow for views to be in a markdown note.
Main reason was to allow for editing the view inside of obsidian without having to use an external editor.
Simply use code blocks. Each block of the same type is added together (js / css).
Change searches for the markdown note first, the simple js file, and then the complex js and css files.
If there is anything I should change, please let me know.
This was tested with the data and views from the https://github.com/s-blu/obsidian_dataview_example_vault
Note View File: views/TestView.md
Note Test File: Test View Example.md