typst icon indicating copy to clipboard operation
typst copied to clipboard

[Feature Request] WaveDrom support

Open capvor opened this issue 2 years ago • 2 comments

Digital Timing Diagram is most useful in electron industry.

I think WaveDrom support is a great feature.

capvor avatar Mar 23 '23 02:03 capvor

I think this is out of scope by default, although a custom function should be able to parse the format.

#let wavedrom(file) = {
    let text = read(file);
    ...
}

I believe that using a rectangle with line in them should work. I think some more drawing primitives may be neccessary.

ollelogdahl avatar Mar 23 '23 08:03 ollelogdahl

I created a small example how this could be implemented. It's not pretty or complete, but it might help you along: test.txt

ollelogdahl avatar Mar 23 '23 13:03 ollelogdahl

I would agree that this is out of scope for the core, but seems like a thing that could be in the package manager once it exists.

laurmaedje avatar Mar 23 '23 20:03 laurmaedje

@laurmaedje @ollelogdahl

My idea is that don't need typst to parse code, just pass code to wavedrom-cli to get the generated svg image, and insert it into the document.

Mermaid support (https://github.com/typst/typst/issues/161) can also be implemented in this way.

capvor avatar Mar 24 '23 01:03 capvor

@laurmaedje @ollelogdahl

My idea is that don't need typst to parse code, just pass code to wavedrom-cli to get the generated svg image, and insert it into the document.

Mermaid support (https://github.com/typst/typst/issues/161) can also be implemented in this way.

That is one solution. One trade-back of this, which i find pretty big, is that text-styling doesn't get preserved. You see, i think that one of the powers is using the same font, size, color, styling in both the text and figures.

ollelogdahl avatar Mar 24 '23 06:03 ollelogdahl