Skip to content

HTML Export #721

Description

@Nitwel

This is all very much my draft notes currently but will be worked upon in the comming days, so take everything with a grain of salt.

tl;dr This is looking really promising already in terms of translatability, the main callenge here will likely be the rewrite of the Layout process into separate steps as discussed.

Comparison Typst => HTML

How easy we could convert most functions into a HTML/CSS counterpart.

Text

  • #lorem() -> #text
  • #emph -> <em>
  • #linebreak -> <br>
  • #lower -> <span class="lower"> or similar with text-transform: lowercase
  • #overline -> <span class="overline"> with text-decoration: overline
  • #raw -> <code> with syntax highlighting done over a <div> instead (possibly highlight.js)
  • #smallcaps -> <span class="smallcaps">
  • #smartquote -> #text
  • #strike -> <s>
  • #strong -> <strong>
  • #sub -> <sub>
  • #super -> <sup>
  • #text -> <span>
  • #underline -> <span class="underline"> with text-decoration: underline
  • #upper -> <span class="upper"> or similar with text-transform: uppercase

Math

Good sauce: https://fred-wang.github.io/TeXZilla/

  • accent -> <mover>
  • attach -> <munderover> / <msubsup>
  • scripts -> <msubsup>
  • limits -> <munderover>
  • binom -> <mrow><mo>(</mo><mfrac linethickness="0px"><mi>n</mi><mi>k</mi></mfrac><mo>)</mo></mrow>
  • cases -> <mrow><mo>{</mo><mtable columnalign="left left" displaystyle="false"></mtable></mrow>
  • equation -> <math>
  • frac -> <mfrac>
  • lr -> <mrow> with <mo>
  • mat -> <mtable>
  • root -> <mroot> and <msqrt>
  • round -> Same as lr
  • styles -> with css
  • op -> <mo> or <mi>
  • under/over -> <munderover>
  • variants -> #text
  • vec -> <mtable>

Layout

  • #align -> <span class="center"> with text-align: center
  • #block -> <div>
  • #box -> <div class="box"> with display: inline-block
  • #list -> <ul>
  • #colbreak -> maybe possible with css break-before: ...
  • #columns -> possible with column-count: 2
  • #grid -> <div class="grid"> with display: grid and so on
  • #hide -> either with opacity: 0 or using a <div> with a fixed width
  • #measure -> maybe possible with js?
  • #move -> with position: relative; top: y, left: x
  • #enum -> <ol> tbh, the name could maybe be improved
  • #pad -> with padding: 10pt 2pt ...
  • #page -> Doesn't make sense in context of web media
  • #pagebreak -> Same as #page
  • #par -> <p>
  • #parbreak -> beginning of new <p>
  • #place -> with position: absolute; top: ...
  • #repeat -> Could maybe be possible with width: 100%; overflow: hidden but very hacky
  • #rotate -> with transform: rotate(...)
  • #scale -> with transform: scale(...)
  • #h -> possibly with position: inline-block; width: ...
  • #v -> same as #h but with height instead of width
  • #stack -> with display: flex
  • #table -> <table>
  • #terms -> <dl>

Visualize

Easily possible using SVG's

  • #circle -> <circle>
  • #ellipse -> <ellipse>
  • #image -> <image>
  • #line -> <line>
  • #path -> <path>
  • #polygon -> <polygon>
  • #rect -> <rect>
  • #square -> <rect>

Meta

  • #bibliography -> Likely with <a href="#el-id"> but has to be looked into
  • #cite -> same as #bibliography
  • #counter -> #text
  • #document -> should be used to insert meta information into the HTML Document.
  • #figure -> <figure>
  • #heading -> <h1> /<h2> / ...
  • #link -> <a>
  • #locate -> Doesn't make much sense in the context of web media / possibly with JS
  • #numering -> #text
  • #outline -> #text
  • #query -> can be ignored
  • #ref -> <a>
  • #state might be ignored
  • #style -> possibly can be ignored

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or requesthtmlRelated to HTML export

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions