Is there a way to add inline HTML to text?

I tried using <span> and other elements, but they all start on a new line. I also checked the HTML itself but couldn’t find a successful workaround.

The desired example would be: a single text line with inline figures.

Apache Parquet #html.elem("img", attrs: (src: "/assets/images/Parquet.png", 
  style: "height:24pt; display: inline; vertical-align: middle")) is a file format. 

Please wrap html.img with html.span.

Explanation can be found in How can I prevent an HTML p tag from being generated magically? - #2 by Y.D.X.

Thanks.

I did some checking. Is span a new feature introduced after 0.12? I’m currently using astro-typst around version 0.12.0‑beta.4 (GitHub - OverflowCat/astro-typst: All-in-one Typst integration for Astro). I think in that case I should not be able to use span as I can not build it .

Indeed. Typed HTML API was introduced in v0.14.0.

You can try html.elem("span", …) instead.

Thanks. I managed to use Typst 0.14 in my dependency. However, I still see my figure and text split into two lines, and I haven’t found a way to force them onto a single line.

This results into two lines still:

#html.span([
  #html.elem("img", attrs: (src: "/assets/images/Parquet.png", style: "height:24pt")) Parquet
])

I didn’t make it clear… I mean this:

#html.span(
  html.img(src: "/assets/images/Parquet.png", style: "height:24pt; display: inline;")
) Parquet

Thanks you.

1 Like