trietnguyen267 / macro_railroad_ext

Display syntax-diagrams for Rust-macros on docs.rs and doc.rust-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

A WebExtension compatible with Chrome, Firefox and Edge to display syntax-diagrams for Rust's macro_rules!() on docs.rs, doc.rust-lang.org and all other pages generated by rustdoc.

A pre-built version for Chrome is published here, for Firefox here, for Edge here

Note: The only reason this extension requests access to file:///* is local documentation; no data is ever transferred. You may need to enable "Allow access to file URLs" in Chromium-based browsers to use the extension with local documentation.

Screenshot

The extension uses macro_railroad to generate diagrams. The diagrams are shown beneath each macro-block. Use the icons in the lower right corner to control options and expand the diagram to fullscreen.

To modify and build the extension locally:

  • Install the cargo-web binary from crates.io.
  • The package in wasm_src can be executed via cargo web start; it serves a testing-page for a quick edit-debug-cycle.
  • The javascript-shim built by cargo-web currently needs a little patching which the Makefile takes care of.
    • Building requires wasm-opt (from binaryen). If wasm-opt is not available, set $TRAVIS to some value.
    • make test executes the integration tests; Chrome is required.
    • make screenshots takes a couple of screenshots on common pages for visual inspection; Chrome is required.
    • make packed.zip builds the extension's compressed archive, which can be loaded into a browser as a temporary extension.
  • Go to "about:debugging" (Firefox) or "chrome://extensions" (Chrome) and use "Load temporary Add-on"/"Load local extension" with manifest.json/packed.zip to load the extension.

About

Display syntax-diagrams for Rust-macros on docs.rs and doc.rust-lang.org

License:MIT License


Languages

Language:Rust 78.5%Language:HTML 9.4%Language:Makefile 7.4%Language:CSS 4.4%Language:JavaScript 0.2%