DEV Community

Syntax Highlighting Is Useless

Dimitri Merejkowsky on October 04, 2018

... at least when it comes to Markdown files ;) Originally published on my blog. Introduction: editing this blog in Neovim Here’s what...
Collapse
 
alainvanhout profile image
Alain Van Hout • Edited

Isn't it simply a case of 'buggy syntax highlighting is useless'? In that case, 'syntax highlighting' becomes the least relevant part of the statement, compared to being the primary subject in the original version.

As for linter-during-typing, that only applies if you see syntax highlighting as a typing aid, which is arguably the least common usage.

In the linked blog post, the example of syntax highlighting applied to fiction is just a bad example because it's bad syntax highlighting regardless of whether the reader approves of syntax highlighting.

Collapse
 
dmerejkowsky profile image
Dimitri Merejkowsky

I agree with you about the weakness of the examples. Coming up with good examples is hard.

Isn't it simply a case if 'buggy syntax highlighting is useless'?

I'm not sure. Maybe they are downsides we don't even think about because we're so used to it.

if you see syntax highlighting as a typing aid, which is arguably the least common usage.

Then, what is it? Is is just for readability? If so, is a well-written code with no colors more readable than badly written code with excellent coloring?

Collapse
 
alainvanhout profile image
Alain Van Hout

Coming up with good examples is hard.

I completely agree. But without appropriate examples, it's all just voicing of opinions without evidence or argumentation.

Maybe they are downsides we don't even think about because we're so used to it.

The only one dowside I've heard of that makes the least bit of sense is that you get used to it and therefore would have trouble if you didn't have it anymore. But the same is true for mostly everything, and it's also highly hypothetical (for most developers at least).

Then, what is it? Is is just for readability? If so, is a well-written code with no colors more readable than badly written code with excellent coloring?

Like the bad example in the linked blog post, this is also an unfair comparison: I'd rather have well-written code. Period. That's a matter that's entirely orthogonal to whether syntax highlighting has
value.

Also, the point of well-written code compared to poorly written code (assuming both of those do what they are supposed to), is exactly for readability, so 'just' doesn't really apply there.

Collapse
 
djcurtin profile image
djcurtin

It is slightly overstating it to say useless, but the value of syntax highlighting on a markdown file should be minimal even if properly implemented. If you were to find a markdown file which would benefit greatly from syntax-highlighting, I would say you found a markdown file that somehow manages to be unnecessarily complex.

Collapse
 
vozeldr profile image
Dewey Vozel

Most often, I don't use markdown to write 'code' that I ever intend to transform into html. I use markdown as my medium for writing, taking notes, documentation, etc. I view these files in text editors and it is great to be able to have my eye drawn to headings and other bits of information when I go back to reference it.

Collapse
 
madalinignisca profile image
Madalin Ignisca

You should specify in the title that it's neovim related. I have no problems with the syntax highlight of markdown in Visual Studio Code and also in Atom. Just works.

Collapse
 
dmerejkowsky profile image
Dimitri Merejkowsky

I just checked and you're right, VS code is better in coloring Markdown than Neovim:

vs markdown

Front matter is properly colored, and the spell checker finds the typo in pyton.

But note the problem with the hugo-specific syntax remains the same.