highlightjs / highlight.js

JavaScript syntax highlighter with language auto-detection and zero dependencies.
https://highlightjs.org/
BSD 3-Clause "New" or "Revised" License
23.76k stars 3.61k forks source link

Request: Add ABC grammar #1609

Closed enderlen closed 5 years ago

enderlen commented 7 years ago

Hi, This ticket for requesting support of ABC format (http://abcnotation.com/wiki/abc:standard:v2.2) br

acrawford13 commented 7 years ago

Hi @enderlen,

I had a go at writing some ABC support, you can play around with it here: http://andreacrawford.design/highlightjs/tools/developer.html

For now it's fairly basic -- do you have any examples of highlighted ABC notation? That might help with seeing what else needs to be highlighted.

Let me know your thoughts

enderlen commented 7 years ago

Hi,

Great news !

I tested this sample ABC on your developer page:

X: 1 // Nice / My first song / T: Misirlou C: N.Roubanis 1934 O: Greece W: 1. Misirlou mou i glikia sou matia W: Floga m'ehi inapsi mes tin kardia W: Ah! Yahabibi Ah! Yaleleli Ah! W: Apto diko sou to sto mataki ime W: Chorus: W: A Misirlou W: Trella tha m'erthi den ipofero pia W: Ah! tha si klepso mes ap tin Arapia. W: Ah Misirlou. W: W: 2. Mavro mata Misirlou mou trelli W: Ti zoi m'allazo mena fili W: Ah! yahabibi M'ena filaki Ah! W: ta dio sou hili stazoune meli ime M: 4/4 L: 1/8 K: Gm |: "D"D3 E ^F2 G2 | A3B ^c2BA | A8- | A8 | w: 1.~Mi-sir-lou mou i gli-kia sou ma-tia w: 2.~Mav-ro ma-ta Mi-sir-lou mou tre-lli | D3E ^F2G2 | A3B ^c2BA | A8- | A8 | w: Flo-ga m'e-hi~i-na-psi mes tin kar-dia w: Ti zo-i m'al-la-zo me-na fi-li | "Gm"BA2B A2G2 | AG2A G2^F2 | "D"^F8- | ^F8 | w: Ah! Ya-ha-bi-bi Ah! Ya-le-le-li Ah! w: Ah! ya-ha-bi-bi M'e-na fi-la-ki Ah! | "Cm"AG2A G2^F2 | ^FE2F E2DD | "D"D8- | D8 :| w: ta dio sou hi-li sta-zou-ne me-li i-me w: Ap-to di-ko sou to sto ma-ta-ki i-me |: "Gm"G8- | G6 ^FG | "F"A8- | A6 GA | "Bm"B6 AB | "A"^c6 Bc | "D"d8- | d8 | w: A____ Mi-sir-lou | "Cm"e d2 e d2 c2 | d c2 d c2 B2 | "D"A8- | A8 | w: Tre-lla tha m'er-thi den i-po-fe-ro pia | "Cm"c B2 c B2 A2 | A G2 A ^F2 E2 | "D"D8- | D8 :| w: Ah! tha si kle-pso mes ap tin A-ra-pia. P: Coda || "Gm"B6 AB | "A"^c6 Bc | "D"d8- | d8- | d8- | d z7 |] w: Ah Mi-sir-lou.

To enhance highlight you could use the following tweaks:

And this should result something really nice ;)

Thanks!

-- Arnaud Enderlen

Le 2017-10-10 02:30, Andrea Crawford a écrit :

Hi @enderlen,

I had a go at writing some ABC support, you can play around with it here: http://andreacrawford.design/highlightjs/tools/developer.html

For now it's fairly basic -- do you have any examples of highlighted ABC notation? That might help with seeing what else needs to be highlighted.

Let me know your thoughts

-- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

acrawford13 commented 7 years ago

I've updated the demo (here)

Song lyrics text can come in a distinct color (text on a line starting with w: or W:), same color can also be applied for quoted text (including quotes) on other lines

Can you check the demo and see if I understood that part correctly?

Whole line starting with a X: is underlined

I don't think I can make it underlined since the stylesheets don't define an underlined style. I've made it bold, does that work?

Cheers :)

enderlen commented 7 years ago

I tested with several files and it saw no major issue, nice ;)

Just an small issue with "[" and "]", sorry I was maybe not that precise these 2 characters only concerns music bars when used with pattern "[|" or "|]". There are some other cases of these 2 characters used within music notes line for voice part and chords, here is I think the "most complex" sample:

M:6/8 L:1/8 K:Gmaj Q:1/4=60 [V:T]"Souplesse rythmique"z2C A,2A, | DD2 E2E | E2E DD2 | E6 | AB2 c2d | c/2B/2AB cA2 | GAB A2A | G/2F/2EF GE2 | \ w:Je crois en un seul Dieu, le Pè-re tout puis-sant, cré-a-teur du ciel et de la ter-re, de l’u-ni-vers vi-sibl(e) et in-vi-si-ble, % [V:T]z2C A,2A, | DD>E E3 | E2E E3 | \ w:Je crois en un seul Sei-gneur, Jé-sus Christ, % [V:T]A[AE][FB] [c2G2][Ad] | [E3A3] G2A | B2A GG>F | E6 | \ w:le Fils u-niqu(e) de Dieu, né du Pèr(e) a-vant tous les siècles : % [V:T]zA,A, E3 | ED2 E3 | z2D E3 | D/C/B,C E3- | E2 D E3 | A,B,C E3 | zGF E3 | C/2B,2A,/2 E3 |] w:Il est Dieu, né de Dieu, lu-mièr(e), né de la lu-mièr(e),* vrai Dieu, né du vrai Dieu En-gen-dré non pas cré-é, %

Thks a lot,

Le 2017-10-11 22:42, Andrea Crawford a écrit :

I've updated the demo (here [1])

Song lyrics text can come in a distinct color (text on a line starting with w: or W:), SAME COLOR CAN ALSO BE APPLIED FOR QUOTED TEXT (INCLUDING QUOTES) ON OTHER LINES

Can you check the demo and see if I understood that part correctly?

Whole line starting with a X: is underlined

I don't think I can make it underlined since the stylesheets don't define an underlined style. I've made it bold, does that work?

Cheers

-- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub [2], or mute the thread [3].

Links:

[1] http://andreacrawford.design/highlightjs/demo/ [2] https://github.com/isagalaev/highlight.js/issues/1609#issuecomment-335941920 [3] https://github.com/notifications/unsubscribe-auth/Aezmp2jTIuCKXPY4yOTBDEpigy6movHyks5srShGgaJpZM4Ptggr

acrawford13 commented 7 years ago

Ok, I've changed it to only highlight "[|" and "|]"

Just wanted to check if comments in this format: // comment are used in ABC notation? I noticed you had them in your test sample, but in the documentation they only mention the format % comment, and they talk about the double slash being used as below:

Note that A/ is shorthand for A/2 and similarly A// = A/4, etc.

For the moment that's causing some issues in lines like this:

[V: 2] ABGA |G2AA|GF=EF |(GF3/2=E//D//E)|1F2z2:|2F8|]

Cheers :)

enderlen commented 7 years ago

Hi,

No you're right it's not part of standard but in common implementation of GUI editors were used to support // or / / comments

I think it is ok if you support only what the standard says ("[:r remark]" and "% comment")

Please note that "%%something" isn't a comment but a directive (e.g.: http://abcnotation.com/wiki/abc:standard:v2.2#stylesheet_directive_definition)

Best regards,

Le 2017-10-12 20:11, Andrea Crawford a écrit :

Ok, I've changed it to only highlight "[|" and "|]"

Just wanted to check if comments in this format: // comment are used in ABC notation? I noticed you had them in your test sample, but in the documentation they only mention the format % comment, and they talk about the double slash being used as below:

Note that A/ is shorthand for A/2 and similarly A// = A/4, etc.

For the moment that's causing some issues in lines like this:

[V: 2] ABGA |G2AA|GF=EF |(GF3/2=E//D//E)|1F2z2:|2F8|]

Cheers :)

-- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub [1], or mute the thread [2].

Links:

[1] https://github.com/isagalaev/highlight.js/issues/1609#issuecomment-336220613 [2] https://github.com/notifications/unsubscribe-auth/Aezmp6-Z_ltPCYm0uPdwNnQoZURh4Mryks5srlZggaJpZM4Ptggr

joshgoebel commented 5 years ago

Closing this issue (as part of our issues cleanup) as it's now being tracked by the pull-request...