summaryrefslogtreecommitdiff
path: root/crates/typst-library/src/html
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2025-01-23 23:18:02 +0100
committerGitHub <noreply@github.com>2025-01-23 22:18:02 +0000
commitcd044825fcb1651781f1dbcafac4dec8b216e370 (patch)
tree8d721ce7ce519fb6d9cb87c3adedc857236de450 /crates/typst-library/src/html
parent6fe1e20afb9e2fb276242613121206b0001cce82 (diff)
Handle boxes and blocks a bit better in HTML export (#5744)
Co-authored-by: Martin Haug <3874949+reknih@users.noreply.github.com>
Diffstat (limited to 'crates/typst-library/src/html')
-rw-r--r--crates/typst-library/src/html/dom.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/crates/typst-library/src/html/dom.rs b/crates/typst-library/src/html/dom.rs
index 5b6eab4d..2acd839d 100644
--- a/crates/typst-library/src/html/dom.rs
+++ b/crates/typst-library/src/html/dom.rs
@@ -210,7 +210,10 @@ impl HtmlAttr {
/// Creates a compile-time constant `HtmlAttr`.
///
- /// Should only be used in const contexts because it can panic.
+ /// Must only be used in const contexts (in a constant definition or
+ /// explicit `const { .. }` block) because otherwise a panic for a malformed
+ /// attribute or not auto-internible constant will only be caught at
+ /// runtime.
#[track_caller]
pub const fn constant(string: &'static str) -> Self {
if string.is_empty() {
@@ -605,6 +608,7 @@ pub mod tag {
/// Predefined constants for HTML attributes.
///
/// Note: These are very incomplete.
+#[allow(non_upper_case_globals)]
pub mod attr {
use super::HtmlAttr;
@@ -619,13 +623,18 @@ pub mod attr {
attrs! {
charset
+ cite
+ colspan
content
href
name
- value
+ reversed
role
+ rowspan
+ start
+ style
+ value
}
- #[allow(non_upper_case_globals)]
pub const aria_level: HtmlAttr = HtmlAttr::constant("aria-level");
}