Open arthur-shaw opened 8 months ago
For Stata-looking style, here are some (subjectively) good looking themes for Stata:
Need a YAML header like this for each:
---
highlight-style: atom-one
---
ayu-dark
:
nord
:
atom-one
, which is adaptive
Note: there's a universal problem of highlighting Stata keywords as code even if they're behind comments. Might need a custom theme for this.
I use the keyword ```stata
in the beginning of a code block. That seems to work. I have however, not built in support for this in ad_sthlp
for when converting .mdhlp
files to .sthlp
. It is quite an easy fix, as all it needs is to test that the only thing coming after ```
is stata
and then just disregard it as there is no syntax highlighting in sthlp
.
It currently already works on README.md and on vignettes and I am already using it on in repkit
. See for example this file: https://dime-worldbank.github.io/repkit/articles/ado-management-with-repado.html. Scroll down for some better examples.
Let me know if you see some reason for why ```stata
is not sufficient.
For adding the language to the codeblock, we could also do this on the adodownr
side.
However we do it, it seems like Stata keywords that appear after comments are still highlighted. Here's an example from repkit (next to last code block on the page you linked) :
If that's OK, we only need to say that these are Stata codeblocks.
If not, we might need to tweak the syntax highlighting tooling--perhaps making upstream changes to the tooling Quarto uses (e.g., Quarto highlights Stata via' Pandoc (see here); we could write a custom highlighter via skylighting (see here).
This turns out to be a Pandoc issue. I can replicate the behavior above with only Pandoc.
I'll raise an issue with Quarto, Pandoc, and/or skylighting, the library Quarto and Pandoc use for syntax highlighting.
I suspect
Steps to reproduce
stata_test.md
containing a Stata code block---
title: Hello
---
Here's some Stata code:
```stata
* Set PLUS to adopath and list it first, then list BASE first.
* This means that BASE is first and PLUS is second.
adopath ++ "${root}/code/ado"
adopath ++ BASE
2. Build HTML file with Pandoc
pandoc stata_test.md -f markdown -t html -s -o stata_test.html
Result:
![image](https://github.com/lsms-worldbank/adodownr/assets/47256431/a63a4c64-76cd-4d2c-a994-d802029bdf28)
We can track things on this issue for skylighting, an upstream component of Pandoc/Quarto.
To my mind, this entails:
This might translate into a few tasks
md
toqmd
. See Quarto docs here.