Skip to content

Commit

Permalink
Add dispatch for QuartoNotebookRunner/typst MIME type (#69)
Browse files Browse the repository at this point in the history
* Add dispatch for QuartoNotebookRunner/typst MIME type

* Update CHANGELOG.md

* add test

* fix test to account for `repr` peculiarity
  • Loading branch information
jkrumbiegel authored Jan 31, 2025
1 parent c381bbe commit 35933ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- Added `show` method for `MIME"QuartoNotebookRunner/typst"` to support typst directly in the native quarto julia engine [#69](https://github.com/PumasAI/SummaryTables.jl/pull/69).
- Allowed `String`s as column identifiers in addition to `Symbol`s [#63](https://github.com/PumasAI/SummaryTables.jl/pull/63).
- Made HTML tables dark mode compatible by reusing foreground color for the lines [#62](https://github.com/PumasAI/SummaryTables.jl/pull/62).

Expand Down
2 changes: 2 additions & 0 deletions src/typst.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Base.show(io::IO, ::MIME"QuartoNotebookRunner/typst", t::Table) = show(io, MIME"text/typst"(), t)

function Base.show(io::IO, M::MIME"text/typst", ct::Table)
ct = postprocess(ct)

Expand Down
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -744,3 +744,9 @@ end
@test str(RF(x, 3, :sigdigits, false)) == "1.23e7"
@test str(RF(x, 3, :digits, false)) == "12345678.91"
end

@testset "QuartoNotebookRunner/typst" begin
t = table_one((; a = 1:3, b = ["A", "B", "C"]))
qnr = String(repr("QuartoNotebookRunner/typst", t)) # `repr` returns binary if `istextmime(mime)` is not overloaded
@test qnr == repr("text/typst", t)
end

0 comments on commit 35933ee

Please sign in to comment.