diff options
| author | Malo <57839069+MDLC01@users.noreply.github.com> | 2025-02-10 11:39:32 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-10 10:39:32 +0000 |
| commit | 25e27169e1413c9e14184267be57fdbbb09e7c34 (patch) | |
| tree | 0f9f811a8c3799c861574d381046db7c68dd698d | |
| parent | 3fba256405c4aae9f121a07ddaa29cc10b825fc9 (diff) | |
Add warning for `pdf.embed` elem used with HTML (#5829)
| -rw-r--r-- | crates/typst-library/src/pdf/embed.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/crates/typst-library/src/pdf/embed.rs b/crates/typst-library/src/pdf/embed.rs index 001078e5..f902e7f1 100644 --- a/crates/typst-library/src/pdf/embed.rs +++ b/crates/typst-library/src/pdf/embed.rs @@ -1,9 +1,12 @@ use ecow::EcoString; +use typst_library::foundations::Target; use typst_syntax::Spanned; -use crate::diag::{At, SourceResult}; +use crate::diag::{warning, At, SourceResult}; use crate::engine::Engine; -use crate::foundations::{elem, Bytes, Cast, Content, Derived, Packed, Show, StyleChain}; +use crate::foundations::{ + elem, Bytes, Cast, Content, Derived, Packed, Show, StyleChain, TargetElem, +}; use crate::introspection::Locatable; use crate::World; @@ -78,7 +81,12 @@ pub struct EmbedElem { } impl Show for Packed<EmbedElem> { - fn show(&self, _: &mut Engine, _: StyleChain) -> SourceResult<Content> { + fn show(&self, engine: &mut Engine, styles: StyleChain) -> SourceResult<Content> { + if TargetElem::target_in(styles) == Target::Html { + engine + .sink + .warn(warning!(self.span(), "embed was ignored during HTML export")); + } Ok(Content::empty()) } } |
