CotEditor icon indicating copy to clipboard operation
CotEditor copied to clipboard

Nested Syntax Highlighting

Open bobrocke opened this issue 9 years ago • 4 comments

Something I do often is to write Markdown for Grav. Something common about that with many other systems is the front matter of the document written in YAML, with the remained in Markdown.

Another example might be Twig in HTML (file.html.twig).

So I'd like to request some way to nest syntax highlighting.

bobrocke avatar Oct 07 '16 18:10 bobrocke

I know such a demand exists. However because CotEditor was not originally designed to have multiple syntax styles in a document at the same time, it requires a fundamental specification change. Therefore it's actually not realistic that I invest a good deal of my time and effort to it, at least for the present.

related: #293

1024jp avatar Oct 07 '16 22:10 1024jp

Nested syntaxes are quite pervasive in web development: HTML files will often have CSS and Javascript inside

Also, with the popularisation of pre-processor languages - such as LESS, SASS, Typescript, HAML and Pug - more and more developers are mixing multiple languages to suit their programming styles.

I often write CMS templates using Pug intermixed with the template's PHP code. All my styles are written in LESS - which I choose over SASS because it can be run in the browser directly, and therefore also embedded into HMTL.

The main reason I looked at CotEditor in the first place was precisely because I was looking for an editor that would handle syntax highlighting of Pug+PHP better than Sublime Text or Atom (which do these very poorly). If this feature were added, it would certainly attract a few interested web developers...

luxlogica avatar Dec 30 '17 00:12 luxlogica

The main reason I looked at CotEditor in the first place was precisely because I was looking for an editor that would handle syntax highlighting of Pug+PHP better than Sublime Text or Atom (which do these very poorly). If this feature were added, it would certainly attract a few interested web developers...

It would attract me for sure. I write mostly VueJS single file components, which have HTML, CSS, and JavaScript highlighting in one file.

jonowells avatar Jul 03 '19 13:07 jonowells

I'd like to add another vote for this. Although we are longtime users of CotEditor, we ended up having to buy another Nova license just to get this feature, since without proper highlighting it's very easy to break the front matter.

We're mainly looking for support for YAML front matter in Markdown files, but it would be great if other front matter formats such as TOML could also be supported.

dcsjapan avatar May 28 '23 04:05 dcsjapan