You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update README and example with hotfix config and PR #14170 notice
Update configuration examples to use nested `hotfix` key. Add hotfix
options table and a dedicated "Temporary Hot-fixes (Typst)" section
explaining that code-annotations and skylighting fixes will be removed
once quarto-dev/quarto-cli#14170 lands.
Add callout note in example.qmd about the temporary nature of Typst
code-annotations support.
| `hotfix.quarto-version` | string | _unset_ | Quarto version at or above which all hot-fixes are automatically disabled. |
83
+
| `hotfix.code-annotations` | boolean | `true` | Enable the code-annotations hot-fix for Typst output. |
84
+
| `hotfix.skylighting` | boolean | `true` | Enable the Skylighting hot-fix for Typst output (overrides block styling and inline code). |
73
85
74
86
### Styles
75
87
@@ -87,17 +99,32 @@ print("Windows style for this block only")
87
99
```
88
100
````
89
101
90
-
### Typst Skylighting Hot-fix (Integrated)
102
+
### Temporary Hot-fixes (Typst)
103
+
104
+
The extension includes two temporary hot-fixes for Typst output that compensate for missing Quarto/Pandoc features.
105
+
Both will be removed once [quarto-dev/quarto-cli#14170](https://github.com/quarto-dev/quarto-cli/pull/14170) is released.
106
+
After that, the extension will focus solely on **auto-filename** and **code-window-style** features.
107
+
108
+
- **`hotfix.code-annotations`**: processes code annotation markers for Typst, since Quarto does not yet support `code-annotations` in Typst output.
109
+
The `filename` attribute for code blocks will also become natively supported.
110
+
- **`hotfix.skylighting`**: overrides Pandoc's Skylighting output for Typst to fix block and inline code styling.
91
111
92
-
`code-window`loads its Typst skylighting hot-fix internally from `_extensions/code-window/skylighting-typst-fix.lua`, so no second filter entry is required.
93
-
Set `skylighting-fix: false` to disable the hot-fix without removing the file.
112
+
Set `hotfix.quarto-version` to automatically disable both hot-fixes once you update Quarto to the version that includes native support:
94
113
95
-
This keeps the hot-fix separated from `code-window.lua` for easy future removal while preserving combined behaviour.
114
+
```yaml
115
+
extensions:
116
+
code-window:
117
+
hotfix:
118
+
quarto-version: "1.10.0"
119
+
```
96
120
97
121
Future removal playbook:
98
122
99
-
1. Remove the skylighting loader call in `_extensions/code-window/code-window.lua`.
Copy file name to clipboardExpand all lines: example.qmd
+74Lines changed: 74 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ filters:
9
9
- at: pre-quarto
10
10
path: code-window
11
11
syntax-highlighting: github-dark
12
+
code-annotations: below
12
13
format:
13
14
html:
14
15
output-file: index
@@ -116,6 +117,75 @@ Plain filename on the left, no window decorations.
116
117
print("Default style window")
117
118
```
118
119
120
+
## Code Annotations
121
+
122
+
::: {.callout-note}
123
+
Typst code-annotations support and `filename` attribute handling are temporary hot-fixes.
124
+
They will be removed once Quarto natively supports these features (see [quarto-dev/quarto-cli#14170](https://github.com/quarto-dev/quarto-cli/pull/14170)).
125
+
The extension will then focus on **auto-filename** and **code-window-style** features.
126
+
:::
127
+
128
+
Code annotations work standalone and together with code-window styling.
129
+
130
+
### Annotations with Explicit Filename
131
+
132
+
```{.python filename="annotated.py"}
133
+
import pandas as pd # <1>
134
+
135
+
df = pd.read_csv("data.csv") # <2>
136
+
summary = df.describe() # <3>
137
+
```
138
+
139
+
1. Import the pandas library.
140
+
2. Load data from a CSV file.
141
+
3. Generate summary statistics.
142
+
143
+
### Annotations with Auto-Filename
144
+
145
+
```python
146
+
defgreet(name: str) -> str: # <1>
147
+
returnf"Hello, {name}!"# <2>
148
+
149
+
result = greet("World") # <3>
150
+
```
151
+
152
+
1. Define a function with type hints.
153
+
2. Use an f-string for interpolation.
154
+
3. Call the function and store the result.
155
+
156
+
### Annotations Spanning Multiple Lines
157
+
158
+
A single annotation number can appear on several consecutive lines.
159
+
Only the first occurrence receives a back-label to avoid duplicates.
160
+
161
+
```{.python filename="pipeline.py"}
162
+
def process(data): # <1>
163
+
cleaned = clean(data) # <1>
164
+
validated = validate(cleaned) # <1>
165
+
result = transform(validated) # <2>
166
+
return result # <3>
167
+
```
168
+
169
+
1. Multi-step input preparation (cleaning and validation).
170
+
2. Apply the main transformation.
171
+
3. Return the final result.
172
+
173
+
### Annotations without Window Chrome
174
+
175
+
Set `code-window-enabled="false"` on a block to disable window chrome while keeping annotations.
176
+
177
+
```{.r code-window-enabled="false"}
178
+
library(ggplot2) # <1>
179
+
ggplot(mtcars) +# <2>
180
+
aes(x=mpg, y=hp) +# <3>
181
+
geom_point() # <4>
182
+
```
183
+
184
+
1. Load the ggplot2 package.
185
+
2. Initialise a plot with the mtcars dataset.
186
+
3. Map aesthetics.
187
+
4. Add a point geometry layer.
188
+
119
189
### Configuration
120
190
121
191
Set the global style in the document front matter:
@@ -124,6 +194,10 @@ Set the global style in the document front matter:
124
194
extensions:
125
195
code-window:
126
196
style: "macos"
197
+
hotfix:
198
+
quarto-version: ~
199
+
code-annotations: true
200
+
skylighting: true
127
201
```
128
202
129
203
Override per block with the `code-window-style` attribute:
0 commit comments