Spacecat's Awesome Documentation Renderer.
A "simple" documentation renderer intended for use with digital electronics projects. Think FPGAs, state-machines, microcontrollers, tooling, etc.
So far it is only intended to be used stand-alone for generating HTML out of extended markdown files, or to generate SVG images using the built-in DSLs.
You will need:
- Maven 3.6.3+
- Some luck
And either:
- GraalVM JDK supporting Java 11+
- Supports direct calls of Node.js libraries using GraalVM's Polyglot API
- This API can be leveraged with the configuration value
ffc.polyglot-js
set toENABLED
orAUTO
- This API can be leveraged with the configuration value
- Supports direct calls of Node.js libraries using GraalVM's Polyglot API
- or some other JDK supporting Java 11+, OpenJDK works.
- Currently,
spacedoc
only supports using external JS runtime provided by Node.js'npx
- External JS libraries can only be used with the configuration value
ffc.polyglot-js
set toDISABLED
- TODO: Auto-detection of non-GraalVM runtimes is currently broken, do not use
AUTO
here (yet).
- TODO: Auto-detection of non-GraalVM runtimes is currently broken, do not use
- External JS libraries can only be used with the configuration value
- TODO: Investigate other JS runtimes for non-GraalVM targets
- In this case, you will also need Node.js
- Do also set the
ffc.npx-executable
value in config. - You will also want to install the required NPX modules.
- To do this, you will need to
npm --install wavedrom-cli
the following - Backstory, according to my understanding.
npx
is used to run pre-packaged Node.JS CLI apps/binaries- For whatever reason,
npx
can download the packages it needs, but by default, it won't install them. And it does this every time it needs to run something. Leading to massive time penalties in case one has to run this multiple times, and in case of SpaceDoc, for every code block to be rendered by, say, WaveDrom.
- Backstory, part II:
- Why the hell would I want to run
wavedrom-cli
in the first place?- Wavedrom supports running in the browser
- They even have a nice online API for generating SVGs for you
- But, I still wanted to have a nice, static HTML spat out, with neat SVGs rendered in without any
JS dependencies.
- That nice Wavedrom online SVG-generating API won't be online forever
- Packaging JS dependencies with the generated HTML site could work, however.
- TODO: Add an option to "null" DSL support for certain languages, passing them through as "regular" code blocks
- Why the hell would I want to run
- To do this, you will need to
- Do also set the
- Currently,
Before building, you may want to read the [configuration](#How do I configure it) section of this readme.
Run the usual mvn clean install
, right in the project's root directory.
Upon a successful build, the resulting .jar
can be found
at [project-root]/spacedoc-executable/target/spacedoc-[version].jar
.
This file can be renamed to spacedoc.jar
, placed somewhere convenient, and used as described in
the [usage](#How do I run it) section of this readme.
TODO: Actually describe how to configure this.
Currently, the only way to configure this is by the use of a .properties file located
at [project-root]/spacedoc-config/src/main/resources/config
, which also gets built into the final .jar
at config/resources
.
Currently, these values are supported:
WARNING: The names of config values will likely change before the next release.
TODO: Autogenerate documentation of config values to keep things relevant
TODO: Add some way of aliasing config values
TODO: Standardize config value naming
TODO: Stop writing todos and use GitHub Issues instead
ffc.npx-executable
- Path to NodeJS'
npx
executable, ornpx.cmd
on Windows. - It currently does not default to whatever is found on
$PATH
yet. - Must be set when
ffc.polyglot-js
isDISABLED
- Path to NodeJS'
ffc.polyglot-js
- Takes one of these values:
ENABLED
- Enables use of GraalVM's Polyglot API
DISABLED
- Disables use of GraalVM's Polyglot APIs, using some fallback instead. This currently means that
npx
will be used instead.
- Disables use of GraalVM's Polyglot APIs, using some fallback instead. This currently means that
AUTO
- Automatically detects whether the Polyglot API can be used.
- Takes one of these values:
general.temp-file-prefix
- All
spacedoc
temporary file names will start with this prefix - May not be set, in which case
spacedoc-temp
will be used by default.
- All
general.temp-directory-path
- Temporary file directory for temporary generated output files
- Typically used by external library calls, such as
wavedrom-cli
.
- Typically used by external library calls, such as
- May not be set, in which case the default system temp path is used.
- Temporary file directory for temporary generated output files
polyglot.js.require.directory
- Path to a directory to store NodeJS module dependencies
- May not be set, in which case
js/require
on the current classpath (think the same directory thespacedoc.jar
is in) is used.- TODO: Verify
Usage:
java -jar spacedoc.jar help
- prints info about some basic usagejava -jar spacedoc.jar [module name] [arguments...]
java -jar spacedoc.jar markdown [arguments...]
-h
or-help
- prints more help about markdown rendering, optional-i [path]
or-input [path]
- path to the input (markdown) file-o [path]
or-output [path]
- path to the output (HTML) file, optional-head [path]
- path to a file to copy at the beginning of the output file, optional-tail [path]
- path to a file to copy at the end of the output file, optional
java -jar spacedoc.jar langRender [arguments...]
-h
or-help
- prints more help about DSL rendering, optional-list
- prints the name of all languages that can be rendered using the built-in DSLs, optional-lang [language]
- specifies the language to use for rendering-i [path]
or-input [path]
- path to the input (DSL) file-o [path]
or-output [path]
- path to the output (SVG) file, optional
There are currently no releases, so you'll have to [build your own](#How do I build it) spacedoc.jar
to use it.
- commonmark-java -based rendering
- Multiple language renderers for fenced code blocks
- Javascript-based renderers - Thanks GraalVM for making this interop possible.
- wavedrom integration - use language "wavedrom".
- viz.js integration - use language "graphviz".
- Custom Wavedrom-like bit-field renderers
- "bitfield" for relatively generic bit field drawings.
- "memory-map" renderer for simplified memory map tables.
- "instruction-set" renderer for simplified instruction format listings.
- Fairly simple infrastructure for further extension
- Not much else so far.
This list has been ordered roughly in the expected order of implementation.
Some to all of these features may never get implemented, so don't get your hopes up. However, this project is nice to procrastinate with, so who knows!
- Write a better readme, perhaps even saying how to even run this
- Document usage, especially of the customized renderers
- Add some demos
- Do configuration a bit better
- Add some way of loading the config file from somewhere else
- Add some way of adding/modifying config options on the command line
- Add some way of generating a config file with default values
- Themes/skinning/styling
- Add support for basic styling/skinning
- BitField renderer
- Pass styles to the external renderers
- Generate Graphviz color schemes
- TODO: Research
- Viz.js support?
- Generate Wavedrom skins
- Generate Graphviz color schemes
- Add support for basic styling/skinning
- Templates!
- Best technical blog tool ever (jk?)
- Table-of-contents generation
- Actually package releases, and indeed release something
- GraalVM's
native-image
- GraalVM's
- Add some actual unit tests
- A formalized plugin system
- We're mostly there, I guess. Just add some way of loading external plugins and registering stuff before the main stuff runs.
- Documentation generation from VHDL/(System)Verilog/other projects
- Parse all the doc-strings!
- All the other things!