@neo4j-devtools/workspace-guides
TypeScript icon, indicating that this package has built-in type declarations

0.0.74 • Public • Published

Guides Parser

Previewing guides

To preview AsciiDoc guides:

  • Run the following command in the directory where you're editing the AsciiDoc guides:
npx @neo4j-devtools/workspace-guides -w
  • Open the Example tab in Workspace Preview,

  • Scroll to Playlist Preview -> Manifest origin override, fill the text field with the server's URL (the default is http://localhost:4000/).

  • Click Update URL and the guides available for preview will be listed in the Guides section.

  • If you add/rename guides you might need to click the Refetch manifest button for them to appear.

Usage

USAGE
$ parse-guides [-i INPUT_DIR_PATH] [-o OUTPUT_DIR_PATH] [--root-url ROOT_URL] [-w] [-m PATH_TO_MANIFEST]

FLAGS
-i, --input-dir=<value>  [default: .] Path to directory containing .adoc guides
-o, --output-dir=<value> [default: generated tmp directory] Path to directory that will contain .json guides
--root-url=<value>       Base URL that output files will be served from
-w, --watch              Watch the input directory for changes and automatically
rebuild guides, also hosts the guides.
-m, --manifest=<value>   Path to guides manifest
-u, --img-base-url=<value> Base URL where images are hosted.
--dry-run

DESCRIPTION
Parse Workspace guides from Adoc to JSON.

EXAMPLES
$ parse-guides --watch

$ parse-guides --watch -u "https://neo4j-graph-examples.github.io/movies/documentation/img/"

$ parse-guides -i path/to/guides/dir -o output/path --watch

$ parse-guides -m path/to/manifest.json

$ parse-guides -m path/to/manifest.json -o output/path

NOTES
The script searches for guides recursively in the input directory, and the path
is be preserved in the output directory.

When specifying a manifest file the `--input-dir` flag is ignored.

Guides manifest

The guides manifest must be a JSON file containing a mapping of IDs and the corresponding url for the adoc guide and an optional base URL for the images contained in the guide. The typing for the manifest is the following.

type GuideManifest = Record<string, { url: string; imgBaseUrl?: string }>;

Example manifest:

{
  "movies": {
    "url": "https://raw.githubusercontent.com/neo4j-graph-examples/movies/main/documentation/movies.workspace.adoc",
    "imgBaseUrl": "https://raw.githubusercontent.com/neo4j-graph-examples/movies/main/documentation/img/"
  },
  "recommendations": {
    "url": "https://raw.githubusercontent.com/neo4j-graph-examples/recommendations/main/documentation/recommendations.workspace.adoc",
    "imgBaseUrl": "https://raw.githubusercontent.com/neo4j-graph-examples/recommendations/main/documentation/img/"
  }
}

Root URL

Image assets used in guides are copied to output directory, to avoid conflicts, they are placed in folders named after guide ID of the guide that uses them. To use correct absolute URLs --root-url CLI argument must be specified.

Example

Prerequisites:

  • a guide file named <input-dir>/guide.workspace.adoc with following contents:

    == Guide Title
    
    image::asset.svg[]
  • a GitHub repository neo4j/guides used to host JSON output on GitHub Pages.

GitHub Pages URLs format is https://<owner>.github.io/<repository> hence root URL will be https://neo4j.github.io/guides:

parse-guides -i <input-dir> -o <output-dir> --root-url https://neo4j.github.io/guides

Result:

  • guide JSON is placed at <output-dir>/guide.json;
  • asset is placed at <output-dir>/guide/asset.svg;
  • asset URL inside the guide JSON is https://neo4j.github.io/guides/guide/asset.svg.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.7414latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.7414
0.0.733
0.0.722
0.0.710
0.0.700
0.0.690
0.0.680
0.0.670
0.0.661
0.0.651
0.0.640
0.0.630
0.0.620
0.0.610
0.0.600
0.0.590
0.0.580
0.0.570
0.0.560
0.0.550
0.0.540
0.0.530
0.0.520
0.0.510
0.0.500
0.0.490
0.0.480
0.0.470
0.0.460
0.0.450
0.0.440
0.0.430
0.0.420
0.0.410
0.0.400
0.0.390
0.0.380
0.0.370
0.0.360
0.0.350
0.0.340
0.0.330
0.0.320
0.0.310
0.0.300
0.0.290
0.0.280
0.0.270
0.0.260
0.0.251
0.0.240
0.0.230
0.0.220
0.0.210
0.0.200
0.0.190
0.0.180
0.0.170
0.0.160
0.0.150
0.0.140
0.0.130
0.0.120
0.0.110
0.0.100
0.0.90
0.0.80
0.0.70
0.0.60
0.0.50
0.0.40
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i @neo4j-devtools/workspace-guides

Weekly Downloads

22

Version

0.0.74

License

none

Unpacked Size

82.5 kB

Total Files

21

Last publish

Collaborators

  • devtools-publisher
  • oskardamkjaer
  • neo4j-organization