Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions news/changelog-1.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ All changes included in 1.8:

- ([#12551](https://github.com/quarto-dev/quarto-cli/pull/12551)): Improve warning issued when `aliases` would overwrite an existing document.
- ([#12616](https://github.com/quarto-dev/quarto-cli/issues/12616)): find SVG images in image discovery for listings.

## Crossrefs

- ([#12615](https://github.com/quarto-dev/quarto-cli/pull/12615)): Adds `algorithm` to theorem environments. (author: @jeremy9959)
9 changes: 7 additions & 2 deletions src/resources/filters/customnodes/theorem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@ theorem_types = {
style = "definition",
title = "Example",
},
exr = {
exr = {
env = "exercise",
style = "definition",
title = "Exercise"
}
},
alg = {
env = "algorithm",
style = "plain",
title = "Algorithm"
},
}

function has_theorem_ref(el)
Expand Down
47 changes: 47 additions & 0 deletions tests/docs/smoke-all/crossrefs/theorem/algorithm.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
format:
typst:
keep-typ: true
_quarto:
tests:
html:
ensureHtmlElements:
-
- "a.quarto-xref"
- []
latex:
ensureFileRegexMatches:
-
- "hypertarget{alg-gcd}"
- "label{alg-gcd}"
- "Alg.~\\\\ref\\{alg-gcd\\}"
- "alg.~\\\\ref\\{alg-gcd\\}"
- []
typst:
ensureTypstFileRegexMatches:
-
- "#ref\\(<alg-gcd>, supplement: \\[alg.\\]\\)"
- "#ref\\(<alg-gcd>, supplement: \\[Alg.\\]\\)"
- "#algorithm\\(\"Euclid\"\\)"
- []
markdown:
ensureFileRegexMatches:
-
- "\\[alg. 1\\]\\(#alg-gcd\\)\\{.quarto-xref\\}" # note the non-breaking space in "alg. 1"
- '\[\*\*Algorithm 1 \(Euclid\)\*\*\]\{.theorem-title\}'
---

::: {#alg-gcd}

## Euclid

```
gcd(a, b) =
if b == 0 then return a
return gcd(b, a mod b)
```

:::


See @alg-gcd. @Alg-gcd has been known since the antiquity.
Loading