pyret-lang icon indicating copy to clipboard operation
pyret-lang copied to clipboard

Pygments

Open shriram opened this issue 5 years ago • 4 comments

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.

shriram avatar Sep 21 '20 12:09 shriram

  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.

blerner avatar Sep 21 '20 12:09 blerner

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.

jpolitz avatar Sep 21 '20 14:09 jpolitz

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. (-:

shriram avatar Sep 22 '20 15:09 shriram

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.

blerner avatar Sep 22 '20 15:09 blerner