0.10.7 • Published 23 days ago

spec-up v0.10.7

Weekly downloads
358
License
Apache 2.0
Repository
github
Last release
23 days ago

Spec-Up is a technical specification development tool that enables you to create rich specification documents for standards bodies and engineering projects by writing in an extended version of markdown that features all the bells and whistles - for example: advanced syntax highlighting, notice blocks, complex tables, charts, UML diagrams, and more.

Setup

Installing Spec-Up is easy peasy lemon squeezy:

  1. Node.JS, i.e. nvm and its package manager npm, are required to run spec-up. WSL2 users should look here for specific instructions.
  2. Run npm install spec-up in the root directory of the repo to install all dependencies.
  3. Create a specs.json file in the root folder of your repository to specify configuration values used in the generation of your spec documents. The values in your specs.json file include things like where your spec's markdown files are located, where to output the generated spec document, and various metadata values used in rendering, such as the title, logo, and repo links for each of your specs. The following are the required/optional fields supported in the specs.json config file:

    • public_root (PATH STRING, optional) - For some platforms and services where you may want to output your rendered spec, the pathing may differ from the directory structure of your local project. To account for this, you can use the public_root property to specify the insertion of a path segment to account for the different in pathing between your local renders and wherever you publish your spec to.
    • specs (ARRAY, required) - the specs array contains descriptor objects for each of the specs you are generating in your project, and are composed of the following required and optional properties:

      • spec_directory (STRING, required) - You must specify the repo-root-relative location of your spec's markdown file directory. You **MUST** name your spec's markdown file spec.md and locate it in your spec_directory for the tool to automatically find and use it for rendering. If you want to use a different name for the markdown file, or you have multiple markdown files you would like the tool to assemble into one document, you must specify them using the optionalmarkdown_paths field described below. See the "multi-file" example in the spec-up repo.
      • title (STRING, required) - You must add a title for your spec, which will be rendered in the generated document's H1 text and page title.
      • logo (PATH/URI STRING, optional) - You may add a reference to a logo asset, either via a path to the asset or a URI
      • logo_link (URI STRING, optional) - The URI you want your logo to point to in the rendered page.
      • markdown_paths (ARRAY, optional) - If you want to name your spec's markdown file something other than spec.md, or you have multiple files you would like assembled into a single output document, you must specify their paths as array entries in the order you would like them assembled. The paths in this array are assumed to be based on the spec_directory you specified, so DO NOT repeat the full root relative path.
      • katex (BOOLEAN, optional) - To enable TeX support via KaTeX, set this property to true. After rendering, be sure to copy the fonts/ subdirectory, containing the necessary web fonts.
      • output_path (STRING, optional) - If you want the generated spec document to be output to a different location than the spec_directory you specified (e.g. the project root for GitHub Pages publishing) you can specify another root relative path (use ./ for root), and the tool will write the document file there instead.
      • source (OBJECT, optional) - this object allows you to configure where repo-specific data is pulled from to power some of the more advanced repo-related features. To do this, specify the code hosting service by adding a service ID string to host (currently Spec-Up only supports "github", but this is extensible), add the account/org the repo is located within via the account property, and add the repo name under the repo property. Here is an example configuration:

        {
            "host": "github",
            "account": "decentralized-identity",
            "repo": "sidetree"
        }
  4. In your main node.js file, or as a package.json script entry, use this invocation call: require('spec-up')()

Boom! That's it. You're ready to start rendering specs as HTML sites locally and/or pushing them to github pages however you see fit to automate.

Running the scripts locally

If your spec.json and package.json and package-lock.json files are in working order and in the root folder of the repo from which it will be deployed, Spec-up can be called by command line (from the root of your repo) in three different modes:

commandbehavior
npm run editafter rendering, this will stay running and the gulp library will watch the source files in your spec directory/ies for changes and re-render any time you save a file. Opening these rendered files in a browser and refreshing them will keep you up to date.
npm run renderthis renders the site once and does not keep a gulpy watch on the underlying files.
npm run devthis enables debugging features.

Automation

The above scripts can easily be triggered by github actions. See this repo's example

Versioning

The recommended method for hosting multiple historical versions of a given specification at the same URL is simply to duplicate the source file(s) in a subdirectory and to host each version in a fixed subdirectory of the output target (i.e., the GitHub-Pages site). These multiple set-up and output directories can be set by multiple spec objects in the specs array of the spec.json file. For example:

{
  "specs": [
    {
      "title": "Wallet And Credential Interactions",
      "spec_directory": "./",
      "output_path": "./build",
      "logo": "https://rawcdn.githack.com/decentralized-identity/decentralized-identity.github.io/a3ca39717e440302d1fd99a796e7f00e1c42eb2d/images/logo-flat.svg",
      "logo_link": "https://identity.foundation",
      "source": {
        "host": "github",
        "account": "decentralized-identity",
        "repo": "waci-presentation-exchange"
      }
    },
    {
      "title": "Wallet And Credential Interactions",
      "spec_directory": "./v0.1.0",
      "output_path": "./build/v0.1.0",
      "logo": "https://rawcdn.githack.com/decentralized-identity/decentralized-identity.github.io/a3ca39717e440302d1fd99a796e7f00e1c42eb2d/images/logo-flat.svg",
      "logo_link": "https://identity.foundation",
      "source": {
        "host": "github",
        "account": "decentralized-identity",
        "repo": "waci-presentation-exchange"
      }
    }   
  ]
}

Note: when copying a version into a subdirectory, relative references, including image links or [include] blocks that copy in example files or test vectors, may break; a quick CTRL-F "../" is recommended

In the above example, the files in ./v0.1.0 will not be rendered by the build process that searches "./" for markdown files and vice versa-- changing either will not trigger a new build of the other in each PR.

Version numbering

DIF Recommends 3-decimal versions à la SemVer (i.e., v0.1.0 instead of v0.1).

Cross-linking across versions

Links from the currently/nightly/unstable spec to stable/archival versions and vice versa are not automatically generated by the current version of spec-up, so the recommended best practice is to manually add links above the "Editors" section. See:

Unstable version:

Presentation Exchange 2.0.0
==================

**Specification Status:** Working Group Draft

**Latest Draft:**
  [identity.foundation/presentation-exchange](https://identity.foundation/presentation-exchange)

**Ratified Versions:**
~ **v1.0.0** - [https://identity.foundation/presentation-exchange/spec/v1.0.0](https://identity.foundation/presentation-exchange/spec/v1.0.0)

Stable Version:

Presentation Exchange v1.0.0
==================

**Specification Status:** DIF Ratified Specification

**Latest Draft:**
  [identity.foundation/presentation-exchange](https://identity.foundation/presentation-exchange)

Archiving stable versions beyond github

Additionally, some editors may prefer to keep an immutable archive in a system like web.archive.org. For example:

**Specification Status:** Draft V0.1 (snapshotted and archived on [web.archive.org](https://web.archive.org/web/20211206215823/https://identity.foundation/waci-presentation-exchange/))

Troubleshooting

  • WSL2 users are recommended to use the bash option rather than PowerShell in the terminal of Visual Studio Code.
  • Some users have reported problems using spec-up with node versions 15+; to pin to an older version, simple run:
nvm install 14
nvm use 14
npm i npm@6.14.16 -g
0.10.7

23 days ago

0.10.6

2 years ago

0.10.4

2 years ago

0.10.5

2 years ago

0.10.3

3 years ago

0.10.2

3 years ago

0.10.1

3 years ago

0.10.0

3 years ago

0.9.104

3 years ago

0.9.103

3 years ago

0.9.102

3 years ago

0.9.101

4 years ago

0.9.100

4 years ago

0.9.99

4 years ago

0.9.96

4 years ago

0.9.97

4 years ago

0.9.98

4 years ago

0.9.94

4 years ago

0.9.95

4 years ago

0.9.93

4 years ago

0.9.92

4 years ago

0.9.91

4 years ago

0.9.90

4 years ago

0.9.89

4 years ago

0.9.88

4 years ago

0.9.87

4 years ago

0.9.85

4 years ago

0.9.86

4 years ago

0.9.84

4 years ago

0.9.83

4 years ago

0.9.82

4 years ago

0.9.80

4 years ago

0.9.79

4 years ago

0.9.78

4 years ago

0.9.77

4 years ago

0.9.76

4 years ago

0.9.75

4 years ago

0.9.72

4 years ago

0.9.73

4 years ago

0.9.71

4 years ago

0.9.70

4 years ago

0.9.69

4 years ago

0.9.68

4 years ago

0.9.67

4 years ago

0.9.66

4 years ago

0.9.65

4 years ago

0.9.64

4 years ago

0.9.63

4 years ago

0.9.61

4 years ago

0.9.62

4 years ago

0.9.60

4 years ago

0.9.59

4 years ago

0.9.58

4 years ago

0.9.57

4 years ago

0.9.56

4 years ago

0.9.55

4 years ago

0.9.54

4 years ago

0.9.53

4 years ago

0.9.52

4 years ago

0.9.50

4 years ago

0.9.51

4 years ago

0.9.49

4 years ago

0.9.48

4 years ago

0.9.47

4 years ago

0.9.45

4 years ago

0.9.46

4 years ago

0.9.44

4 years ago

0.9.43

4 years ago

0.9.42

4 years ago

0.9.41

4 years ago

0.9.39

4 years ago

0.9.40

4 years ago

0.9.37

4 years ago

0.9.38

4 years ago

0.9.35

4 years ago

0.9.36

4 years ago

0.9.34

4 years ago

0.9.32

4 years ago

0.9.31

4 years ago

0.9.30

4 years ago

0.9.29

4 years ago

0.9.27

4 years ago

0.9.28

4 years ago

0.9.26

4 years ago

0.9.25

4 years ago

0.9.23

4 years ago

0.9.24

4 years ago

0.9.21

4 years ago

0.9.22

4 years ago

0.9.20

4 years ago

0.9.19

4 years ago

0.9.18

4 years ago

0.9.17

4 years ago

0.9.12

4 years ago

0.9.13

4 years ago

0.9.14

4 years ago

0.9.15

4 years ago

0.9.10

4 years ago

0.9.11

4 years ago

0.9.16

4 years ago

0.9.9

4 years ago

0.9.8

4 years ago

0.9.7

4 years ago

0.9.6

4 years ago

0.9.5

4 years ago

0.9.4

4 years ago

0.9.3

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago