jgm / skylighting

A Haskell syntax highlighting library with tokenizers derived from KDE syntax highlighting descriptions
194 stars 62 forks source link

Syntax Highlighting for Stata #74

Closed randrescastaneda closed 5 years ago

randrescastaneda commented 5 years ago

Dear all,

Is it possible to add Stata syntax highlighting to skylighting? I say someone tried to do so in #47 but I could not find any follow up.

Thank you so much for your help.

Best, Andres

jgm commented 5 years ago

First thing is to check the KDE repository to see if they have a stata.xml syntax definition. See the documentation for this library for information on how to find that repo. If there is one, it should be easy to include.

randrescastaneda commented 5 years ago

HI @jgm,

Kyle Barron, the person who raised issue #47, suggested the following xml repo . Does it work?

Thank you so much.

Best,

jgm commented 5 years ago

Since you have the xml file, you can already use it to do stata highlighting with skylighting. See loadSyntaxFromFile. Or, with pandoc, the --syntax-definition option.

We could consider adding it as a compiled module -- I try to add things only when needed, to keep the size of the package down, but if this is the second request it's probably enough for me.

sunnyarlington commented 5 years ago

I really this package as well. It would be appreciated if you can add this. Thank you.

JavierParada commented 5 years ago

Dear John @jgm, I agree that adding Stata syntax highlighting to skylighting would be very useful. Thanks!

randrescastaneda commented 5 years ago

Thank you so much, @jgm, for adding the Stata syntax highlighting.

One final question (please, forgive my ignorance), does Pandoc get updated automatically? I am using Rstudio to execute Pandoc, but I think either Pandoc or Rstudio (or both), must be updated for the Stata syntax be taken into account, right? Do you have any guidance on this?

Thanks again. Best,

jgm commented 5 years ago

This will be in the next release of pandoc, but in the mean time you need to use --syntax-definition stata.xml as noted above.

randrescastaneda commented 5 years ago

Awesome. Thank you so much.

However, when I tried to use the --syntax-definition=stata.xml I got the following error: Am I doing something wrong?

image

Thank you so much.

Best,

jgm commented 5 years ago

Are you using the latest pandoc?

Should be fixed by now: https://github.com/jgm/pandoc/issues/5328

If not, there's a link to language.dtd in that thread; just put it in your working directory with stata.xml.