Bug 269243

Summary: Shell syntax highlighting is broken in some places
Product: Documentation Reporter: Ciarán Ainsworth <cda>
Component: Books & ArticlesAssignee: Sergio Carlavilla Delgado <carlavilla>
Status: Closed FIXED    
Severity: Affects Some People CC: carlavilla, koston
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
URL: https://docs.freebsd.org/en/books/handbook/basics/#users-rmuser
Attachments:
Description Flags
A screenshot showing broken syntax highlighting
none
A screenshot showing fixed syntax highlighting none

Description Ciarán Ainsworth 2023-01-30 12:35:30 UTC
Created attachment 239805 [details]
A screenshot showing broken syntax highlighting

I didn't find any issues relating to this, so please close this down if it's already being tackled elsewhere.

I noticed while editing a page recently that the syntax highlighting in VS Code wasn't happy with the formatting of some of the text. It looks like this is caused by unescaped single quotes in some of the code blocks. These are making the highlighter unhappy and are causing some oddities in the application of syntax highlighting in the published pages (see attached).

Rather than escaping these, I think the solution is to mark these blocks as "console" rather than "shell". The code in question is not a shell script but rather a console prompt. If we change the highlighting, this fixes the highlighter's complaint in the IDE and also unifies the highlighting in the published article.

This issue may be in quite a few places, so I'm not sure whether it is best to tackle this as one large patch or to split it up.
Comment 1 Ciarán Ainsworth 2023-01-30 12:35:48 UTC
Created attachment 239806 [details]
A screenshot showing fixed syntax highlighting
Comment 2 Atte Peltomäki 2023-07-01 23:49:59 UTC
Testing change from source type shell to console reveals problems with latter too, although less.

A foolproof fix would be changing the :source-highlighter: header to 'none', but docs team needs to weigh in on that.

I would personally not bother with source highlighting, at least until syntax parsing responsibility is outsourced to Treesitter.
Comment 3 commit-hook freebsd_committer freebsd_triage 2023-07-13 11:04:10 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/doc/commit/?id=bb920e6c2c674c98bc8090cb19d5580ba842716f

commit bb920e6c2c674c98bc8090cb19d5580ba842716f
Author:     Sergio Carlavilla Delgado <carlavilla@FreeBSD.org>
AuthorDate: 2023-07-13 11:02:04 +0000
Commit:     Sergio Carlavilla Delgado <carlavilla@FreeBSD.org>
CommitDate: 2023-07-13 11:02:04 +0000

    Improve some shell syntax highlighting in basics chapter

    PR:             269243
    Submitted by:   Ciarán Ainsworth <ciaranainsworth@gmail.com>
    Sponsored by:   Daifressh

 .../content/en/books/handbook/basics/_index.adoc   | 78 +++++++++++++++++++++-
 1 file changed, 76 insertions(+), 2 deletions(-)
Comment 4 Sergio Carlavilla Delgado freebsd_committer freebsd_triage 2023-07-13 11:09:13 UTC
Fixed, when the handbook working group progresses through the entire Handbook, these problems will be resolved