GithubHelp home page GithubHelp logo

coastalwhite / wavedrom-rs Goto Github PK

View Code? Open in Web Editor NEW
70.0 1.0 2.0 1.45 MB

Beautiful Digital Timing Diagrams with Rust

Home Page: https://coastalwhite.github.io/wavedrom-rs

License: Apache License 2.0

Rust 84.11% HTML 8.05% JavaScript 5.60% Python 1.17% SCSS 0.02% Shell 0.27% Nix 0.78%
diagrams digital logic svg timing wasm wavedrom waveform

wavedrom-rs's Issues

Can only render one diagram per file

When you include a second diagram in a Markdown file neither one is rendered and you just see the fenced code. For example include this diagram.md file in SUMMARY.md:

# Waveform Test

Here we do a quick test of [MdBook-WaveDrom](https://github.com/coastalwhite/wavedrom-rs/tree/main/mdbook-wavedrom-rs).

```wavedrom
{
    signal: [
        { name: "clk", wave: "p......." },
        { name: "pulses", wave: "0..10.10" },
    ]
}

Another diagram:

{
            signal: [
                 { name: "clk", wave: "p.........." },
                    { name: "req", wave: "0.10......." },
                    { name: "data", wave: "x......2.x.", data: "0xBEEF" },
                    { name: "done", wave: "0......1.0." },
            ]
    }

End of Waveform Test


The output is:

![Output](https://github.com/coastalwhite/wavedrom-rs/assets/8484427/e76ed4e2-13ea-4f3f-8f47-5fd567138b0f)

SVG Text Anchor position for Inkscape PDF-TeX export

Hi !

I really appreciate this project as it is way simpler to customize the appearance of the diagrams. However, I noticed that on the exported SVG files, the anchor for text boxes is positioned in the middle. This is a problem since when converting the SVG to a PDF file with LaTeX text using Inkscape, the obtained text is positioned higher than it should be.

Here is an example of what I mean:
SVG file
image

Produced LaTeX PDF with Inkscape export
image

It would be awesome if the text anchor was by default as it is in Inkscape, enabling fast integration of the diagrams in LaTeX documents.

Seems like the property that is in charge of this is: dominant-baseline="middle"

Here is the SVG code for the example SVG file used above

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   width="210mm"
   height="297mm"
   viewBox="0 0 210 297"
   version="1.1"
   id="svg1"
   inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
   sodipodi:docname="testing.svg"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
  <sodipodi:namedview
     id="namedview1"
     pagecolor="#ffffff"
     bordercolor="#000000"
     borderopacity="0.25"
     inkscape:showpageshadow="2"
     inkscape:pageopacity="0.0"
     inkscape:pagecheckerboard="0"
     inkscape:deskcolor="#d1d1d1"
     inkscape:document-units="mm"
     inkscape:zoom="4.1725703"
     inkscape:cx="394.72073"
     inkscape:cy="419.64542"
     inkscape:window-width="1920"
     inkscape:window-height="1164"
     inkscape:window-x="0"
     inkscape:window-y="36"
     inkscape:window-maximized="1"
     inkscape:current-layer="layer1"
     showguides="true">
    <sodipodi:guide
       position="118.59244,201.21439"
       orientation="0,-1"
       id="guide1"
       inkscape:locked="false" />
  </sodipodi:namedview>
  <defs
     id="defs1" />
  <g
     inkscape:label="Calque 1"
     inkscape:groupmode="layer"
     id="layer1">
    <rect
       style="fill:#e8d5c4;stroke-width:0.352777;stroke-linecap:square;stroke-linejoin:round"
       id="rect1"
       width="56.30822"
       height="5.9605546"
       x="76.845886"
       y="92.805336" />
    <text
       text-anchor="middle"
       dominant-baseline="middle"
       font-family="Helvetica"
       font-size="3.70417px"
       fill="#000000"
       letter-spacing="0"
       id="text55"
       x="110.42086"
       y="94.868874"
       style="text-align:center;text-anchor:middle;white-space:pre;inline-size:30.1773;stroke-width:0.264583"
       transform="translate(8.1011636,0.90747783)"
       xml:space="preserve"><tspan
         x="110.42086"
         y="94.868874"
         id="tspan2">Bad anchor pos</tspan></text>
    <text
       xml:space="preserve"
       style="font-size:3.88056px;line-height:normal;font-family:Carlito;-inkscape-font-specification:Carlito;text-align:center;text-decoration-color:#000000;text-anchor:middle;fill:#000000;stroke-width:1.05833;-inkscape-stroke:none;stop-color:#000000"
       x="91.673836"
       y="96.820175"
       id="text111"><tspan
         sodipodi:role="line"
         id="tspan111"
         x="91.673836"
         y="96.820175"
         style="stroke-width:1.05833">Good anchor pos</tspan></text>
  </g>
</svg>

wavedrom-rs won't build

It won't build because it's using an unstable library feature:

  • once_cell
  • nonzero_min_max

The cargo install mdbook-wavedrom-rs command itself also appears to pull in Rust 1.67.1 but we're at version 1.70 now.

Am I missing an incantation?

Yes, I am! It appears we need to use the nightly build of Rust to use unstable features:

rustup override set nightly
cargo install mdbook-wavedrom-rs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.