Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Turn Off Highlights In Ace Editor For Specific Lines

This isn't a full set, but this is how you can override syntax highlighting for certain lines in the Ace Editor.

The method makes a new style sheet that's appended to the document and updates it that way. The CSS does `:not` with `:nth-child` to select all the lines other than the one you're after.

TBD if there's a way to do that to not highlight two lines

Code

const removeHighlights = () => {
  console.log('removeHighlights')
  s.styleOverride = document.createElement('style')
  s.styleOverride.innerHTML = `
.ace-monokai .ace_line:not(:nth-child(2)) .ace_keyword,
.ace-monokai .ace_line:not(:nth-child(2)) .ace_lparen,
.ace-monokai .ace_line:not(:nth-child(2)) .ace_rparen,
.ace-monokai .ace_line:not(:nth-child(2)) .ace_entity,
.ace-monokai .ace_line:not(:nth-child(2)) .ace_name,
.ace-monokai .ace_line:not(:nth-child(2)) .ace_function,
.ace-monokai .ace_line:not(:nth-child(2)) .ace_source,
.ace-monokai .ace_line:not(:nth-child(2)) .ace_rust
{
  color: #777;
}
`
  document.body.appendChild(s.styleOverride)
}

NOTE, to do it for multiple lines

Code

.ace-monokai .ace_line:not(:nth-child(2)):not(:nth-child(3)) .ace_keyword { color: green; }

That will do all lines except 2 and 3