Skip to content

Commit

Permalink
doc: switch to mdbook
Browse files Browse the repository at this point in the history
Fixes #569.
  • Loading branch information
tkurki committed Dec 5, 2021
1 parent ace24a8 commit 6beec58
Show file tree
Hide file tree
Showing 40 changed files with 39 additions and 27 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ thumbs.db
.vscode

#Generated by publishing docs
gitbook-docs/otherBranches.md
gitbook-docs/vesselsBranch.md
mdbook/src/otherBranches.md
mdbook/src/vesselsBranch.md

#Generated
src/keyswithmetadata.json
mdbook/[0-9]*
dist
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ thumbs.db
.vscode

#Gitbook source files, original and generated
gitbook-docs
mdbook
1 change: 0 additions & 1 deletion gitbook-docs/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion gitbook-docs/.npmignore

This file was deleted.

4 changes: 0 additions & 4 deletions gitbook-docs/book.json

This file was deleted.

3 changes: 3 additions & 0 deletions mdbook/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
book
otherBranches.md
vesselsBranch.md
5 changes: 5 additions & 0 deletions mdbook/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[book]
authors = []
language = "en"
multilingual = false
src = "src"
18 changes: 18 additions & 0 deletions mdbook/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '3'

services:
mdbook:
container_name: mdbook
image: peaceiris/mdbook:v0.4.13
stdin_open: true
tty: true
ports:
- 3000:3000
- 3001:3001
volumes:
# - ${PWD}/gitbook-docs:/book
- ${PWD}/mdbook:/book
command:
- serve
- --hostname
- '0.0.0.0'
7 changes: 1 addition & 6 deletions gitbook-docs/README.md → mdbook/src/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# Introduction

This is the documentation for the [Signal K Specification](https://github.com/signalk/specification) _version_
version, which is available in the following formats;

* [html](http://signalk.org/specification/_version_/doc/) (this document) _version_
* [pdf](http://signalk.org/specification/_version_/doc/signalk.pdf)
* [epub](http://signalk.org/specification/_version_/doc/signalk.epub)
* [mobi](http://signalk.org/specification/_version_/doc/signalk.mobi)
version ([permalink](http://signalk.org/specification/_version_/doc/)).

## What is Signal K?

Expand Down
2 changes: 1 addition & 1 deletion gitbook-docs/SUMMARY.md → mdbook/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Signal K Specification

* [Signal K Specification](README.md)
* Getting Started
* [Getting Started]()
* [Using SK](start_using.md)
* [Developing with SK](start_developing.md)
* [Data Model]()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@
"schema:version": "cross-var replace-in-file /https:\\\\/\\\\/signalk.org\\\\/specification\\\\/[\\\\w\\\\.]+\\\\/schemas\\\\//g https://signalk.org/specification/$npm_package_version/schemas/ './**/*.j*' --ignore=./package.json,./node_modules/** --isRegex --verbose",
"schema:publish": "git checkout gh-pages && git checkout master -- schemas && cross-var mkdir $npm_package_version && cross-var git add $npm_package_version && cross-var git mv schemas/ $npm_package_version/ && git commit -m \"Schemas from master\" && git push",
"docs:changelog": "github-changes -f gitbook-docs/changelog.md -o signalk -r specification -a --only-pulls --use-commit-body --data=pulls",
"docs:prep": "gitbook install gitbook-docs && cross-var replace-in-file /_version_/g $npm_package_version ./gitbook-docs/* --isRegex --verbose && mdprepare gitbook-docs/*.md",
"docs:prep": "cross-var replace-in-file /_version_/g $npm_package_version ./mdbook/src/* --isRegex --verbose && mdprepare mdbook/src/*.md",
"docs:keys": "node scripts/processSchemaFiles.js",
"docs:html": "cross-var gitbook build gitbook-docs $npm_package_version/doc",
"docs:pdf": "cross-var gitbook pdf gitbook-docs $npm_package_version/doc/signalk.pdf",
"docs:mobi": "cross-var gitbook mobi gitbook-docs $npm_package_version/doc/signalk.mobi",
"docs:epub": "cross-var gitbook pdf gitbook-docs $npm_package_version/doc/signalk.epub",
"docs:serve": "gitbook serve gitbook-docs",
"docs:all": "npm run docs:prep && npm run docs:changelog && npm run docs:keys && npm run docs:html && npm run docs:pdf && npm run docs:mobi && npm run docs:epub",
"docs:publish": "npm run docs:all && cross-var git add $npm_package_version && git stash && git checkout gh-pages && git pull && cross-var git checkout stash -- $npm_package_version && git add master && cross-var git commit --allow-empty -m $npm_package_version && git push [email protected]:signalk/specification gh-pages"
"docs:html": "cross-var docker-compose -f mdbook/docker-compose.yml run mdbook build -d $npm_package_version/doc",
"docs:serve": "docker-compose -f mdbook/docker-compose.yml up",
"docs:all": "npm run docs:prep && npm run docs:changelog && npm run docs:keys && npm run docs:html",
"docs:publish": "TODO npm run docs:all && cross-var git add $npm_package_version && git stash && git checkout gh-pages && git pull && cross-var git checkout stash -- $npm_package_version && git add master && cross-var git commit --allow-empty -m $npm_package_version && git push [email protected]:signalk/specification gh-pages"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -56,7 +53,6 @@
"chai": "^1.9.2",
"cross-var": "1.1.0",
"fsnip": "^0.9.5",
"gitbook-cli": "^2.3.0",
"github-changes": "^1.0.4",
"infuse.js": "^2.0.2",
"markdown-it": "^8.0.0",
Expand Down
4 changes: 2 additions & 2 deletions scripts/processSchemaFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ class Parser {
})

fs.writeFileSync(path.join(__dirname, '../src/keyswithmetadata.json'), JSON.stringify(keysWithMeta, null, 2))
fs.writeFileSync(path.join(__dirname, '../gitbook-docs/vesselsBranch.md'), vesselsDoc)
fs.writeFileSync(path.join(__dirname, '../gitbook-docs/otherBranches.md'), othersDoc)
fs.writeFileSync(path.join(__dirname, '../mdbook/src/vesselsBranch.md'), vesselsDoc)
fs.writeFileSync(path.join(__dirname, '../mdbook/src/otherBranches.md'), othersDoc)
})

/*
Expand Down

0 comments on commit 6beec58

Please sign in to comment.