This Vue.js webapp is a simple reader for Markdown files generated using Gitbook.
To use this viewer you will need a Github Repository which contains:
- Markdown files as generated by Gitbook via the inbuilt Github integration
- A
package.jsonfile at the repository root folder. This will allow us to usenpmoryarnto pull down the Markdown document content and set it as a frontend dependency.
For demonstration, this project has already installed the converse-docs package dependency, which contains the Product Documentation for TAIGER Converse.
- When the project is compiled with
yarn run serveoryarn run build, the markdown files are compiled into HTML markup and copied into the project public folder (seevue.config.jsfor details). Images in the Gitbook assets folder are also copied. - The HTML files and assets are placed in a
TARGET_DOC_FOLDER, specified indocs-config.js.
- When the application is loaded, vue-router will take the Markdown folder path and file name from the URL in the browser window.
- The 2 values are passed to the
MarkdownViewercomponent, which will load the corresponding HTML text content via HTTP, and render the it on the UI. - For example:
<base-url>/README.mdwill load theREADME.htmlfound at root folder/of theTARGET_DOC_FOLDER<base-url>/essentials/quickstart/introduction.mdwill load theintroduction.htmlfound at/essentials/quickstartin theTARGET_DOC_FOLDER
- The
MarkdownViewercomponent also:- Parses the loaded HTML file and looks for header anchor links to display on the right sidebar.
- Retrieves content for the left sidebar with the links to other pages of the Gitbook, found at
SUMMARY.md. This file is automatically generated by Gitbook when exporting to Github.
yarn install
yarn add ssh://git@github.com:taigers/<your-docs-repo-name>.git#<version>
// docs-config.js
module.exports = {
..
NODE_PACKAGE_NAME: '<your-package-name>'
..
}yarn run serve
yarn run build
yarn run test
yarn run lint
