5

On the Music Practice and Theory Stack Exchange main site there are over 400 Questions with the tag. These are based on the music programming language LilyPond, with most such questions and answers necessitating blocks of code.

Syntax highlighting exists on a large number of stack exchange sites, and can be requested on sites that do not yet have it enabled (see this Meta post). I believe that most questions under the LilyPond tag will substantially benefit from some form of syntax highlighting, so:

I am requesting LilyPond syntax highlighting for Music Practice and Theory Stack Exchange.


Here is a bunch of (somewhat random) posts that would certainly benefit from LilyPond syntax highlighting:

MIDI count in with Lilypond

How can I change slur from above to below notes when switching staff in Lilypond?

Lilypond - Modern Gregorian Drop Cap Letter

Square brackets in lilypond

NullVoice is affecting the orientation of ties and slurs in LilyPond

Center a note in lilypond

How to cross staff slurs in lilypond?

Can't get Lilypond volta repeat to work with parallel music (multiple staves) and the \alternative construct

LilyPond: stack order of Multimark engraver

Lilypond: Set key change signature before D.C. or D.S., and different key in next line

Lilypond: How to create an ossia Staff above a PianoStaff?

How to force a page break in LilyPond

How to split multi-voice lilypond scores to multiple midi outputs (e.g. for choir practice)

Creating trill staff in lilypond

1
  • 1
    Agreed. We field enough LilyPond questions that syntax highlighting would be a significant benefit.
    – Aaron
    May 12, 2022 at 19:41

2 Answers 2

3

Note that Stack Exchange is using a 3rd-party library highlight.js for syntax highlighting, and looks like it currently doesn't support LilyPond syntax.

Stack Exchange does not have its own syntax highlighting engine. It uses highlight.js, and may not necessarily be using the latest release of that library. Therefore, any bugs and feature requests regarding syntax highlighting cannot be handled by Stack Exchange.

So, before requesting to enable the existing syntax highlighter that will possibly not work effectively anyway, you might try to request highlight.js to add support for LilyPond first.

Requesting that a new language which is not currently supported by highlight.js be added

Follow the instructions in Reporting a bug or requesting a feature for a language supported on Stack Exchange above to request that highlight.js support your new language. Once the language is supported by highlight.js, follow Requesting that Stack Exchange support a new language which is already supported by highlight.js to make it available here on Stack Exchange.

Which is

Reporting a bug or requesting a feature for a language supported on Stack Exchange

Go to the list of existing issues in highlight.js GitHub repository and check to see if your request is already filed there, and if not, post it there.

If your bug fix or feature request has already been fixed or implemented by highlight.js but isn't working here, please wait, as new versions of highlight.js are deployed on the sites on a scheduled basis, and the latest version hasn't been deployed yet. (If it hasn't been deployed after a long time, you can post a feature request here on Meta asking that Stack Exchange update to the latest version.)

then,

Requesting that Stack Exchange support a new language which is already supported by highlight.js

If a language is already on the list of languages supported by highlight.js, but is not supported on Stack Exchange (see Language codes currently available on Stack Exchange below), you can raise a feature request here on Meta to ask for it to be deployed on the network.

While it's fine to request for the SE team to add additional supported languages, these requests are extremely likely to be considered low-priority and as such deferred. The current response for such feature requests is that the team finds that the added trade-offs from supporting more languages outweigh their potential benefit, though they're looking for future ways to lighten it.


Otherwise, the community may be better to suggest a ready-to-use LilyPond syntax highlighter library that can be embedded on the website since it is very unlikely for the Stack Exchange team to create a new syntax highlighter specifically for LilyPond from scratch.

0

I don't know if this would help, but there is a Linux CLI utility that produces syntax highlighted HTML (any a lot of other things too). It's by the people who bring you Frescobaldi.

python-ly

You can use it like this:

$ ly highlight source.ly > source.html
1
  • 1
    I'm unclear on how this would allow for highlighting LilyPond code within Music SE posts. By converting the output to an image and posting the image?
    – Aaron
    May 14, 2022 at 23:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .