canvas/svg vs html #490
-
The approach of rendering to svg and canvas elements either directly or from an intermediate form has interesting use cases like the previewer. For other use cases like books it's certainly great that they can be rendered to a web page at all but there seem to be some inherent constraints to the ability to adequately select text and copy&paste it, not any different to what's usually the case for pdf documents. How do you see the future of typst.ts for publishing sites and blogs (what's mentioned as "Static but responsive rendering" in the README), specially when there seems to be momentum and will to add html output to typst? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
The future of Typst.ts for publishing sites and blogs, particularly with its "Static but responsive rendering" feature, can be promising, especially considering the growing interest in static site generators (SSGs) and the need for flexible and efficient content publishing solutions. Here are some considerations for Typst.ts in this context:
Overall, the future of Typst.ts for publishing sites and blogs looks promising, especially with the addition of HTML output and continued focus on responsive rendering. By catering to the evolving needs of publishers and leveraging modern web technologies, Typst.ts can become a valuable tool for content creators looking to deliver engaging and accessible content to their audience. |
Beta Was this translation helpful? Give feedback.
-
I think all of them can take a place in typst.ts, but it rather requires more efforts. This is what I'm going on the road to a better document format (than PDF). This framework are also inspired by pdf.js. Three layersHTML (Semantic) Layerit brings semantic ability to adequately select text, copy text, paste text, link reaction, and so on. currently better text output than PDFNow we have generally better text output than PDF, especially whitespaces. Because PDF infers that whitespaces by layout spaces, but we get whitespaces information from typst and embed it inside of the HTML layer. currently worse text selection than PDFBut we have a poor text selection, because we don't get nice layout information from typst.
SVG LayerIt can also retrieve user events as DOM nodes, but too many SVG nodes on will degrade performance of the webpage significantly. We current start to make use of both SVG and Canvas export. We render typst elements inside of window (screen, or viewport) as SVG, because:
Canvas (Display) LayerThe canvas has less pressure to HTML layout, so we render those elements which don't have interaction to the user as canvas. For example, we render typst elements outside of window as canvas. Note: it could be also replaced by other advanced rasterization technique. For example, render typst with vello (webgpu acceleration). linebender/vello#466 Responsiveness
Compare with official HTML exportOfficial HTML export should:
Semantics+SVG+Canvas export
|
Beta Was this translation helpful? Give feedback.
I think all of them can take a place in typst.ts, but it rather requires more efforts. This is what I'm going on the road to a better document format (than PDF). This framework are also inspired by pdf.js.
Three layers
HTML (Semantic) Layer
it brings semantic ability to adequately select text, copy text, paste text, link reaction, and so on.
currently better text output than PDF
Now we have generally better text output than PDF, especially whitespaces. Because PDF infers that whitespaces by layout spaces, but we get whitespaces information from typst and embed it inside of the HTML layer.
currently worse text selection than PDF
But we have a poor text selection, because we don't get nice…