emanote
emanote copied to clipboard
WikiLink Embedding - ![[..]]
Support for https://help.obsidian.md/How+to/Embed+files
- [x] Working prototype for .md and image files (#68)
- [x] Allow specifying note embed layout via Heist .tpl (#75)
- [x] ~~#88~~
- [x] #98
- [ ] Other file types
- [x] video
- [x] audio
- [x] pdf
- [x] #350
- [ ] Everything else? As code block. For eg.,
foo.hs
gets syntax highlighted as haskell.- [ ] Properties? (file line nums, note snippet, ...)
I propose adding an item to the checklist above:
- [ ] Allow embedding a specific subset block of a file.
For instance, the ## Some Section
H2 heading and all text until next section. Obsidian's syntax is basically: ![[filename#Some Section]]
Obsidian supports this and it would be great to have parity between Obsidian editing and Emanote's rendered results.
Embedding notes may create loops:
some_note.md:
blah
![[other_note]]
blah
other_note.md:
aaa
![[some_note]]
bbb
I've tried it with the live preview and couldn't open any of these notes in browser. Didn't have time to check memory/CPU usage etc., but perhaps the loops should be detected anyway?
@vcavallo Yes, we need to address it in a fundamental manner first: https://github.com/EmaApps/emanote/discussions/105
@kukimik Could you open a new issue?
I think we should also support source code embedding. For eg., ![[foo.hs]]
should include that as syntax highlighted code block. See also https://github.com/srid/neuron/issues/613 (not sure how that can be adopted for wiki links)
@kukimik Could you open a new issue?
With the current version of emanote I can display the page. It looks like this:
It no longer loops indefinitely. (Or maybe it never did? I upgraded my hardware in the meantime; maybe I was just lacking resources - which however would mean the resource consumption was excessive.)
So I can open an issue, but I don't treat the current behavior as a bug/problem.
I am working on adding code files embedding support. I decided to hijack this post to ask if anyone knows a good way to solve this challenge I am facing:
The embed template itself. I realized I am not familiar with the way code blocks get rendered in HTML. I have inspected the source code and apparently they get transformed into <code>
tags. The content of the code block then gets highlighted by using <span>
of a specific class attribute so it gets properly highlighted (via highlight.js
). The challenge then, is to take the code file content and embed it correctly in a <code>
tag.
Does anyone more familiar or knowledgeable can see a way to do this?
Edit: I think I am on the right track. I figured I could just redundantly call hljs.highlighAll();
.