question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: Only syntax highlight range

See original GitHub issue

It’s not uncommon to see presentations or code images where most of the code is de-coloured / not syntax highlighted, and only a specific range or set of ranges are highlighted.

I’ve worked out a possible solution.

CodeMirror supports marking a range of text with a class. https://codemirror.net/doc/manual.html#api_marker

The CSS can then be added to make ALL text grey (or a themes comment colour?), only keeping the syntax highlighting for a specific section.

The CSS would look something like…

:not(.colourise) > span {
    color: gray !important;
}

Applying the class of colourise to a presentation span, then results in the attached screenshot result. Screen Shot 2019-07-19 at 15 32 10

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
mfix22commented, Jul 19, 2019

This is a lesser known feature, but we already have support for highlighting/selecting lines. You have to turn on “Line numbers” in the settings, but then by clicking on the line numbers you can (de)select certain lines to highlight them. If you click, and then Shift-click another line, that will batch select a group of lines.

We also want to use opacity in order to ensure that deselection always looks good, no matter what the theme is.

1reaction
Relequestualcommented, Aug 19, 2019

I wish I had time @mfix22! Appreciate you working on this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Is Syntax Highlighting? - MakeUseOf
It typically highlights keywords, string literals, and other syntactic elements. Syntax highlighting can also draw attention to syntax errors.
Read more >
python - Syntax Highlighting in Cocoa TextView? Experiences ...
I would suggest taking a look at the source code to Smultron. It has very nice syntax highlighting. It uses a subclass of...
Read more >
Extension:SyntaxHighlight - MediaWiki
The SyntaxHighlight extension, formerly known as SyntaxHighlight_GeSHi, provides rich formatting of source code using the ‎<syntaxhighlight> tag.
Read more >
A case against syntax highlighting - Linus Åkesson
Syntax highlighting is a standard feature of most modern text editors and development environments. The basic idea is to exaggerate the visual ...
Read more >
Syntax Highlight Guide | Visual Studio Code Extension API
Syntax highlighting determines the color and style of source code displayed in the Visual Studio Code editor. It is responsible for colorizing keywords...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found