Skip to content

Commit 03dc6fb

Browse files
mcanouilcderv
andauthored
feat(constants.lua): add typst and ojs comment symbols for code-annotations (#13856)
* feat(constants.lua): add typst and ojs comment symbols for code-annotations * test: add comprehensive code annotation support test for all 49 languages * chore: update the changelog to include new code-annotation languages support --------- Co-authored-by: Christophe Dervieux <christophe.dervieux@gmail.com>
1 parent 9c6d652 commit 03dc6fb

3 files changed

Lines changed: 537 additions & 46 deletions

File tree

news/changelog-1.9.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,4 @@ All changes included in 1.9:
128128
- ([#13575](https://github.com/quarto-dev/quarto-cli/pull/13575)): Improve CPU architecture detection/reporting in macOS to allow quarto to run in virtualized environments such as OpenAI's `codex`.
129129
- ([#13656](https://github.com/quarto-dev/quarto-cli/issues/13656)): Fix R code cells with empty `lang: ""` option producing invalid markdown class attributes.
130130
- ([#13832](https://github.com/quarto-dev/quarto-cli/pull/13832)): Fix `license.text` metadata not being accessible when using an inline license (`license: "text"`), and populate it with the license name for CC licenses instead of empty string. (author: @mcanouil)
131+
- ([#13856](https://github.com/quarto-dev/quarto-cli/issues/13856)): Add code annotation support for Typst and Observable.js code blocks. (author: @mcanouil)

src/resources/filters/modules/constants.lua

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -74,63 +74,65 @@ local kCssPropertyProcessing = "css-property-processing"
7474

7575
-- for a given language, the comment character(s)
7676
local kLangCommentChars = {
77-
r = {"#"},
78-
python = {"#"},
79-
julia = {"#"},
80-
scala = {"//"},
81-
matlab = {"%"},
82-
csharp = {"//"},
83-
fsharp = {"//"},
84-
c = {"/*", "*/"},
85-
css = {"/*", "*/"},
86-
sas = {"*", ";"},
87-
powershell = {"#"},
77+
apl = {""},
78+
asy = {"//"},
79+
awk = {"#"},
8880
bash = {"#"},
89-
sql = {"--"},
90-
mysql = {"--"},
91-
psql = {"--"},
92-
lua = {"--"},
93-
cpp = {"//"},
81+
c = {"/*", "*/"},
9482
cc = {"//"},
95-
stan = {"#"},
96-
octave = {"#"},
83+
coffee = {"#"},
84+
cpp = {"//"},
85+
csharp = {"//"},
86+
css = {"/*", "*/"},
87+
d3 = {"//"},
88+
dockerfile = {"#"},
89+
dot = {"//"},
90+
elm = {"#"},
9791
fortran = {"!"},
9892
fortran95 = {"!"},
99-
awk = {"#"},
93+
fsharp = {"//"},
94+
gap = {"#"},
10095
gawk = {"#"},
101-
stata = {"*"},
102-
java = {"//"},
96+
go = {"//"},
10397
groovy = {"//"},
104-
sed = {"#"},
105-
perl = {"#"},
106-
ruby = {"#"},
107-
tikz = {"%"},
98+
haskell = {"--"},
99+
html = {"<!--", "-->"},
100+
java = {"//"},
101+
javascript = {"//"},
108102
js = {"//"},
109-
d3 = {"//"},
103+
json = {"//"},
104+
julia = {"#"},
105+
latex = {"%"},
106+
lua = {"--"},
107+
markdown = {"<!--", "-->"},
108+
matlab = {"%"},
109+
mermaid = {"%%"},
110+
mysql = {"--"},
110111
node = {"//"},
112+
ocaml = {"(*", "*)"},
113+
octave = {"#"},
114+
ojs = {"//"},
115+
perl = {"#"},
116+
powershell = {"#"},
117+
psql = {"--"},
118+
python = {"#"},
119+
r = {"#"},
120+
ruby = {"#"},
121+
rust = {"//"},
122+
sas = {"*", ";"},
111123
sass = {"//"},
124+
scala = {"//"},
112125
scss = {"//"},
113-
coffee = {"#"},
114-
go = {"//"},
115-
asy = {"//"},
116-
haskell = {"--"},
117-
dot = {"//"},
118-
mermaid = {"%%"},
119-
apl = {""},
120-
yaml = {"#"},
121-
json = {"//"},
122-
latex = {"%"},
126+
sed = {"#"},
127+
sql = {"--"},
128+
stan = {"#"},
129+
stata = {"*"},
130+
swift = {"//"},
131+
tikz = {"%"},
123132
typescript = {"//"},
124-
swift = { "//" },
125-
javascript = { "//"},
126-
elm = { "#" },
127-
vhdl = { "--"},
128-
html = { "<!--", "-->"},
129-
markdown = {"<!--", "-->"},
130-
gap = { "#" },
131-
dockerfile = { "#" },
132-
ocaml = { "(*", "*)"},
133-
rust = { "// "}
133+
typst = {"//"},
134+
vhdl = {"--"},
135+
yaml = {"#"}
134136
}
135137
local kDefaultCodeAnnotationComment = {"#"}
136138

0 commit comments

Comments
 (0)