Improve R documentation highlighting
ClosedPublic

Authored by aaronpuchert on Oct 20 2018, 4:38 PM.

Details

Summary

After trying out the highlighting on a larger set of files and reading
parts of the specification again, I've come to the conclusion that there
is room for improvement. The following changes are included:

  • Sections don't support markup, so we highlight them as "names": \name, \keyword, \docType and \encoding.
  • The \email keyword nominally supports markup inside of it, but it's not clear how that actually works, so we highlight it as verbatim.
  • We separate R and R-like contexts. The former are actual R code and might be executed as such, but the latter will not be executed, and might not even be syntactically correct R code. So we don't use R highlighting for R-like code, and rather print it as verbatim.
  • We now support \verb and \figure which I forgot for some reason in the original version.
  • We added some markup support inside of R code. Note that because we also use R highlighting, the markup only works on the top level.
  • Error recovery wasn't any good. When expecting an argument and not getting it, we now back off after highlighting whatever comes before the next opening brace. Otherwise it's just to noisy when writing code. We also highlight extra spaces before { as erroneous.
  • Spell checking makes no sense for R source, item names and errors.

Diff Detail

Repository
R216 Syntax Highlighting
Branch
improve-rdoc
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 4081
Build 4099: arc lint + arc unit
aaronpuchert created this revision.Oct 20 2018, 4:38 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptOct 20 2018, 4:38 PM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
aaronpuchert requested review of this revision.Oct 20 2018, 4:38 PM
dhaumann accepted this revision.Oct 20 2018, 5:09 PM

Looks good to me, please commit.

This revision is now accepted and ready to land.Oct 20 2018, 5:09 PM
This revision was automatically updated to reflect the committed changes.

Thanks for the quick review!