trilium icon indicating copy to clipboard operation
trilium copied to clipboard

How can I have language-specified code blocks inside an actual box?

Open jbhanks opened this issue 4 years ago • 7 comments

If in a text note I type ``` I get a block in which I can put code. However, because the box appears immediately, I cannot specify the language. Alternatively, I can create a markdown note and if I use the backticks and a language name, I get the syntax highlighting. But the code is not in a box. Is there a way I can have syntax-highlighted text inside a code box?

jbhanks avatar Mar 11 '20 01:03 jbhanks

Is there a way I can have syntax-highlighted text inside a code box?

This is not supported and I don't think it's coming anytime soon since it would require some kind of integration between CKEditor and CodeMirror. There have been discussions about this in CKEditor issues, but nothing came out of it so far ...

zadam avatar Mar 11 '20 08:03 zadam

Ok thanks, maybe I'll find one of those threads and upvote it. As an alternative, would it be possible to have a toggle for markdown rendering? That way I could switch to code when taking a new note, but have it in nice, rendered markdown when I am browsing.

jbhanks avatar Mar 11 '20 19:03 jbhanks

would it be possible to have a toggle for markdown rendering?

Sorry, but I don't really plan to implement any markdown specific features such as this.

WYSIWYG is the preferred way to edit text in Trilium and that's where my focus is. My time is limited so I'd rather focus on one way rather than split my time on two different ways to do the same thing ...

zadam avatar Mar 11 '20 19:03 zadam

@zadam

Any plans to replace CKeditor with something else? It seems like most of the Trilium limitations all boil down to what CKEditor can do, this is very evident based on the replies you provided in my reports too.

gerroon avatar Mar 11 '20 20:03 gerroon

No plans in this direction, there isn't anything better to my knowledge.

zadam avatar Mar 11 '20 21:03 zadam

Now I have code blocks inside notes, I can specify the language but not get syntax highlighting :( This is pretty confusing. It's a pity because Trilium Notes is pretty and functional. And it is very cumbersome to change the language (but currently has no purpose) image

pihentagy avatar Nov 06 '20 10:11 pihentagy

Check https://github.com/zadam/trilium/discussions/2822 for realtime syntax highlight on codeblocks

antoniotejada avatar Apr 28 '22 14:04 antoniotejada