ners / ners.ch

Personal website
4 stars 1 forks source link

Overriding `templates` #2

Open srid opened 2 years ago

srid commented 2 years ago

I just wanted to tell you that there is no need to copy over the entire templates directory. If you are modifying a single file, then copying only that file (maintaining path) should suffice. Because emanote will use the missing files from the 'default' layer (included in Emanote).

Example: https://github.com/srid/srid/tree/master/content/templates

srid commented 2 years ago

Also, I noticed that syntax highlighting appears broken. Prism.js is known to not work well with other JS. But highlight.js does work well according to an user: https://github.com/srid/emanote/discussions/281

You can use it via <snippet var="js.highlightjs" />. See https://raw.githubusercontent.com/srid/emanote/master/docs/tips/js/mermaid.md

(I should probably switch Emanote to use highlight.js by default.)

ners commented 2 years ago

Thank you for the valued feedback, @srid. I am looking forward to contributing to emanote.

there is no need to copy over the entire templates copying only [that file] (maintaining path) should suffice

I find myself tinkering with the templates often enough that I thought it's best to just copy them all. That way I also have their designs in front of me when working with the repository tree. It's not an ideal solution, because it might drift against upstream. Ideally there could be some kind of override mechanism.

I noticed that syntax highlighting appears broken

I've also found that Prism.js is pretty unreliable. On some page loads it simply won't highlight.

I should probably switch Emanote to use highlight.js by default

I'd be happiest if there was an option to use Pandoc's skylighting highlighter server-side. I know it's probably not as feature-full as some of these JS highlighters, but it it supports all the languages I can think of, and removes one nontrivial runtime dependency.

On a a similar note, I wish there was a way to render maths on the backend as well. KaTeX has a provision for it, but ideally I'd like it done in Pandoc. That way we could also enjoy JS-free maths typesetting in, say, EPUBs.

srid commented 2 years ago

I find myself tinkering with the templates often enough that I thought it's best to just copy them all. That way I also have their designs in front of me when working with the repository tree. It's not an ideal solution, because it might drift against upstream.

That makes sense. We can actually state this trade-off in the Emanote docs.

Ideally there could be some kind of override mechanism.

Not sure what you mean. The 'overlay' feature already does this (IIUC what you are referring to).


Re: backend syntax/math processing, I'd be open to PRs for that. Those are good ideas, especially if done as an opt-in feature. I'd like to see what the end-user visible differences would be. I do recall Pandoc's own syntax highlighting being rather not as nice as the client-side ones. Also, since Emanote uses Nix - it should be fairly simple to use non-Haskell dependencies, though if running KaTex involves shelling out (to nodeJS?) that might add an annoying performance cost to Emanote's live-server updates. Speaking of nodeJS, I actually want to figure out a way to directly use TailwindCSS compiler as well (cf. https://github.com/srid/ema/issues/20); one idea is to run nodeJS as a long-running process and communicate to it from Haskell through IPC.