diff options
Diffstat (limited to 'crates/typst-library/src/model/emph.rs')
| -rw-r--r-- | crates/typst-library/src/model/emph.rs | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/crates/typst-library/src/model/emph.rs b/crates/typst-library/src/model/emph.rs index 2d9cbec1..6267736b 100644 --- a/crates/typst-library/src/model/emph.rs +++ b/crates/typst-library/src/model/emph.rs @@ -1,10 +1,4 @@ -use crate::diag::SourceResult; -use crate::engine::Engine; -use crate::foundations::{ - elem, Content, NativeElement, Packed, Show, StyleChain, TargetElem, -}; -use crate::html::{tag, HtmlElem}; -use crate::text::{ItalicToggle, TextElem}; +use crate::foundations::{elem, Content}; /// Emphasizes content by toggling italics. /// @@ -29,24 +23,9 @@ use crate::text::{ItalicToggle, TextElem}; /// This function also has dedicated syntax: To emphasize content, simply /// enclose it in underscores (`_`). Note that this only works at word /// boundaries. To emphasize part of a word, you have to use the function. -#[elem(title = "Emphasis", keywords = ["italic"], Show)] +#[elem(title = "Emphasis", keywords = ["italic"])] pub struct EmphElem { /// The content to emphasize. #[required] pub body: Content, } - -impl Show for Packed<EmphElem> { - #[typst_macros::time(name = "emph", span = self.span())] - fn show(&self, _: &mut Engine, styles: StyleChain) -> SourceResult<Content> { - let body = self.body.clone(); - Ok(if styles.get(TargetElem::target).is_html() { - HtmlElem::new(tag::em) - .with_body(Some(body)) - .pack() - .spanned(self.span()) - } else { - body.set(TextElem::emph, ItalicToggle(true)) - }) - } -} |
