kach / nearley

📜🔜🌲 Simple, fast, powerful parser toolkit for JavaScript.
https://nearley.js.org
MIT License
3.59k stars 232 forks source link

Highlight grammars in docs #282

Open tjvr opened 7 years ago

tjvr commented 7 years ago

We should pull in @Hardmath123's syntax highlighting for use in the docs. https://github.com/github/linguist/pull/3781

kach commented 7 years ago

I don't think highlight.js takes .tmlanguage files…

glmdgrielson commented 6 years ago

I'll do it.

```nearley
# Test for balancing parentheses, brackets, square brackets and pairs of "<" ">"

@{% function TRUE (d) { return true; } %}

P ->
      "(" E ")" {% TRUE %}
    | "{" E "}" {% TRUE %}
    | "[" E "]" {% TRUE %}
    | "<" E ">" {% TRUE %}

E ->
      null
    | "(" E ")" E
    | "{" E "}" E
    | "[" E "]" E
    | "<" E ">" E
leads to 
```nearley
# Test for balancing parentheses, brackets, square brackets and pairs of "<" ">"

@{% function TRUE (d) { return true; } %}

P ->
      "(" E ")" {% TRUE %}
    | "{" E "}" {% TRUE %}
    | "[" E "]" {% TRUE %}
    | "<" E ">" {% TRUE %}

E ->
      null
    | "(" E ")" E
    | "{" E "}" E
    | "[" E "]" E
    | "<" E ">" E
tjvr commented 6 years ago

We might need to replace highlight-js with linguist, or write a new language definition file for highlight-js (or any other JS syntax highlighter, really!)

glmdgrielson commented 6 years ago

Oh wait, you meant on the website... :sweat_smile: Well, I'll get to editing the HTML if you would like.