Typst Preview on the Forum

Is it possible to have a Typst preview of some code in the forum ?

If not, it would be a great feature that would make easier to answer question. Instead I always have to open thè web app and take screenshots and paste and copy the code :sweat_smile:

It is actually the only thing is a bit better on discord for quick question / answer.

It’s not possible; it would probably require some kind of plugin that would be a bit harder to write than e.g. the Discord bot.

There’s no way around some amount of manual pasting, but note that instead of manually screenshotting a specific region of the screen, you can use (at least in Firefox) the browser’s screenshot tool. Since it is aware of HTML elements, it lets you exactly screenshot a page of the preview. Alternatively, since the preview is an image, you can “Open Image in New Tab” and then copy the image from there to paste it.

It’s not ideal, but for now these will probably remain the best options we have.

1 Like

I do agree that I was a bit exagerating that it was hard. It will also make it easier for people to do minimum working version of any issue.

Is it really not feasible ? I think it is, it would be an option and the compiler won’t be download for every user but just the one clicking on something like “show preview of my code”. Typst on the web is not that hard, and this is a skill that the typst team has totally.

After my arguments, there is of course the argument of time. This is not that important of a feature and migth add complexity for not that much.

Thanks for the browser tip ! I will definitely try that one :grin:

It depends on what you define as “feasible”. The Discord bot was made by a community member; that’s possible because Discord makes it easy to create such bots. The forum is run by the Typst company, so a plugin installed in the forum would need to be either developed by them, or at least audited to be safe to run on their infrastructure. I also know from the forum’s launch that Discourse is quite resource intensive and, let’s say, not the easiest software to host, so I’d expect the team would be reluctant to run it in a very non-standard configuration.

My assessment of the team’s stance may be wrong here of course, but I would not expect a lot of movement.

1 Like

Just to clear up my thinking. I was thinking of the compiler beeing run in the client side. Then this compilers generates let’s say a png that gets put on beside the code that generates it.

Like in the web app, there is no server cost of doing that. Except maybe :

  • download the compiler but usually realeses are stored on github or some kind of package repo
  • it may make people generate more pictures on the forum that the sever have to store

On a static site hosting service (such as github pages) I can already do such a thing and output some svg of the writing of a string in the browser.

This is an exemple of such an app : Typ-pad: summing sinusoids.
This is the typ pad repo that is composed of no more than 200 line of JavaScript and download typst.js and run it.

I really don’t think it is the feasibility that matters here :thinking:.

I totally agree that this will no be possible to be implemented by any user because the forum is closed source :sweat_smile: definitely a Typst team thing.

The forum is largely open-source, because Discourse is.

My bad :eyes: this is interesting. I don’t know If they have the same flexibility as with the Typst web app, it might be one point where it is really harder to embed (like in the web app) a typst compiler for us to use.

1 Like