highlightjs / highlightjs/highlight.js

Discuss: Higher fidelity language highlighting (in general)

Open
#2,500 30 comments 1 reaction 0 assignees View on GitHub
big picture discuss/propose help welcome language
Dominant language
JavaScript
Stars
25k
Forks
3.8k
Avg merge
11h 35m
Merged PRs (30d)
3

Description

Taking over this issue to use it as the proposal for higher fidelity highlighting as a general idea and a plan to get there - if we should (I think we should).

---

[Editor] **Original issue content:**

The short version is I want to get this (the C# snippet from the highlight.js website):
![image](https://user-images.githubusercontent.com/904226/79879670-27d73a00-842e-11ea-9ff6-ca69f311ef0c.png)

Closer to this (same snippet but in the latest version of Visual Studio 2019):
![image](https://user-images.githubusercontent.com/904226/79880250-ebf0a480-842e-11ea-8498-540c794bb605.png)

Actual snippet of code:
```
using System.IO.Compression;

#pragma warning disable 414, 3021

namespace MyApplication
{
[Obsolete("...")]
class Program : IInterface
{
public static List JustDoIt(int count)
{
Console.WriteLine($"Hello {Name}!");
return new List(new int[] { 1, 2, 3 })
}
}
}
```

My question isn't about writing the CSS to do that for a theme, its about having classes to target those styles in the first place. Where does the use of a specific highlight.js class start and end (eg. "hljs-function" for declarations but not calls?). Like, is there a spec somewhere for when something should be used?

I've read through some of the related issues like #1731 and #1378 so I do understand reluctance for adding classes that can target these types of cases as core functionality especially when not all languages do this. I guess I'm querying, more as a guide, if I were to implement (some of) this for C#, I don't want to step on toes about class name consistency.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.