typemill / typemill

Typemill is a lightweight, flat-file CMS designed for simple, fast, and flexible website and eBook creation using Markdown.
https://typemill.net
MIT License
427 stars 60 forks source link

Syntax highlighting for the raw editor #129

Closed Tekl closed 4 months ago

Tekl commented 4 years ago

The visual editor is great for short texts and editing existing text. But for longer texts the raw editor gives me a better writing experience because. Though it would be nice to have some sort of syntax highlighting for the raw editor.

trendschau commented 4 years ago

That is not possible because the content is inside a textarea and I don't want to add a js-editor just for syntax highlighting. If you know any other lightweight solution then let me know.

Tekl commented 4 years ago

I understand that you don't want loose the simplicity of a textarea. As I understand it right, some Highlighters can deal with textareas. Here are two examples:

https://codepen.io/aktorou/pen/YWxorK https://codepen.io/kazzkiq/pen/xGXaKR/

EasyMDE also seems to work with textareas.

trendschau commented 4 years ago

Yes, but EasyMDE is a js-editor that I mentioned before. There are plans to improve the raw editor and add some kind of basic editor, but it has low prio. Anyway, the raw markdown-editor only accepts pure markdown, no html, so I think that syntax-highlighting has a limited value here right now.

Tekl commented 4 years ago

Oh, thought the textarea is the key point. Well, I think it wouldn't be possible without JavaScript. The main value of highlighting would be to better distinguish headlines from the body text. I see that it is only useful for some users like me and shouldn't bloat the core. Does the current state of the plugin API allow me to add this feature with a plugin?

trendschau commented 4 years ago

The key point of Typemill is the visual editor, I personally do not use the raw editor. Right now it is not possible to change the raw-editor with a plugin.

But I understand a bit better now: You do not want a syntax-highlighter for code-snippets (what the highlight-plugin does), but you want to have a formatted/html-transformed version of the Markdown that you type into the textarea, correct? So similar to the way Grav CMS does it.

That is only possible with a js-editor, and probably all of those markdown-editors base on the editor codemirror. Best known is simpleMDE and easyMDE is a fork of that. You can read about it here (german): https://cmsstash.de/website-praxis/markdown-fur-webseiten#markdown-online-editoren

This is planned, but not in near future because it is a nice-to-have feature in my eyes (the visual markdown editor of Typemill does quite a good or even better job for those, who want to have a visual preview for markdown).

So I will label this ticket to enhancement, but don't expect this feature for this year.

Tekl commented 4 years ago

Well, it was just a suggestion, maybe it would be better to improve the visual editor so that the raw editor is less needed. See #133

trendschau commented 4 months ago

Syntax highlighting of markdown is added in version 2 of Typemill. However, there are still are no edit-buttons for the raw editor.