Introduction

GemBook renders Markdown content into a website and generates pages based on the directory structure. GemBook is a document site generation tool created for Gem. It is also written using Gem. It has a symbiotic relationship with Gem. It uses the custom element <gem-book> render content.

Getting Started

You can try it online directly at StackBlitz.

WARNING

GemBook depends on Node.js v18+, please ensure that the node -v command can be executed

# Create docs mkdir docs && echo '# Hello GemBook!' > docs/readme.md # Write and preview gem-book docs # Specify title gem-book docs -t MyApp # Specify logo gem-book docs -t MyApp -i logo.png # Render readme.md/index.md as the project homepage gem-book docs -t MyApp -i logo.png --home-mode # Build front-end resources gem-book docs -t MyApp -i logo.png --home-mode --build

More options.

Use <gem-book>

The above command uses webpack to package a complete front-end project, but you can also use the <gem-book> element directly in HTML.

# Install as dependency npm install gem-book # Only generate <gem-book> requires json configuration file npx gem-book docs -t MyApp -i logo.png --home-mode --build --json

Then use <gem-book> in your project:

import { html, render } from '@mantou/gem'; import 'gem-book'; import config from './gem-book.json'; render(html`<gem-book .config=${config}></gem-book>`, document.body);

You can use the <gem-book> element in any framework.

Goal

  • Build documentation into front-end projects
  • Provide a command line to parse the directory into a <gem-book> configuration file
  • Provide <gem-book> for front-end projects
  • Provide API for users to extend