brownplt / pyret-lang

The Pyret language.
Other
1.07k stars 110 forks source link

Pygments #1531

Open shriram opened 4 years ago

shriram commented 4 years ago

Several tools, especially Markdown-related, seem to use Pygments for code formatting:

https://pygments.org/docs/lexers/

Not sure whether Ben has Pygments support and if so what it takes to upload it here and make it available for Markdown formatters.

blerner commented 4 years ago

1) This is a non-sequitur for the pyret-lang repo, right? This is a CPO-related question? 2) I don't have any support for pygments at the moment, and I don't see how it would be used for CPO, either -- where does Markdown show up in Pyret or CPO? 3) For written things like PAPL or course sites, pygments might be useful, but again, I haven't ever built out support for that.

jpolitz commented 4 years ago

For anyone coming to this issue and wondering how e.g. www.pyret.org manages syntax highlighting, for web sites we use CodeMirror-mode, which uses JavaScript and CodeMirror along with pyret-codemirror-mode to format a textarea.

shriram commented 4 years ago

I specifically filed it under the language and not CPO because things like books and Web sites are not related to CPO.

That's quite a reply, @blerner: items 1 and 2 seem to cancel each other out, and item 3 seems to directly contradict and address item 1! But just to be clear, the answer is item 3. (-:

blerner commented 4 years ago

I couldn't figure out which context you were asking for this in. :) Pyret syntax highlighting is slightly tricky, in that there are a few places where the highlighting is context-sensitive (specifically, in how we highlight type annotations), and AFAIK, pygments is a purely tokenization-based highlighter.

If someone wants to take this on, that'd be nice, but I don't think I have the cycles to build this myself right now... A Pyret pygments mode would be a separate repo, akin to the pyret-codemirror-mode repo.