GithubHelp home page GithubHelp logo

yamkazu / gaiden Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kobo/gaiden

2.0 2.0 0.0 1.77 MB

Gaiden is a tool that makes it easy to create documentation with Markdown.

License: Apache License 2.0

Groovy 96.71% CSS 2.48% JavaScript 0.81%

gaiden's Introduction

Gaiden

Build Status

Gaiden is a tool that makes it easy to create documentation with Markdown. It assumes familiarity with the command-line. The Groovy language is the base of the tool.

Getting Started

You need a Java SE installed, but it is not necessary to install Groovy because it's bundled with the Gaiden distribution.

Installing Gainden on Unix based systems is easiest with GVM:

$ gvm install gaiden

Or download a binary distribution of Gaiden and unpack it into some file on your local file system. Add the bin directory path in unpacked the distribution to your PATH environment variable.

Then in a shell, type the following:

$ gaiden create-project sample-project
$ cd sample-project
$ gaiden build

You can see the documentation built when you open build/index.html file in your web browser.

Commands

The basic usage is:

$ gaiden <command name>
create-project <project name>
The starting point for Gaiden. The create-project command creates the project directory using the <project name> specified by user.
build
The build command builds HTML pages from Markdown files using templates, and copies static resources.
clean
The clean command deletes all built and copied resources.

Project Structure

  • build/ - Built documents and static resources will be placed under this directory.
  • pages/ - The place of source Markdown files. The directory layout will be kept when it is placed in the build directory.
    • toc.groovy - The table of contents written by DSL. See ToC.
  • static/ - The place of static resources. All of the files and subdirectories will be copied under the build directory.
  • templates/ - The place of template files. See Template.
  • GaidenConfig.groovy - The configuration file. See Configuration.

Template

The cool template is provided by default in Gaiden. Alternatively, if you don't like it very much, you can customize the template. To customize the template, you will need to edit the templates/layout.html file.

The most simple template is the following:

<html>
<head>
    <title>$title</title>
</head>
<body>
    $content
</body>
</html>

You can use extension properties and methods which start with $ in the template. It can be used to refer to variables or run helper methods.

Extension Property and Method

Gaiden supports the following extension properties and methods by default:

title
A title of a documentation which can be configured in GaidenConfig.groovy:
<title>$title</title>
content
A content of html which is generated from a Markdown source in the pages directory:
<body>
    $content
</body>
resource
Creates a link to the static resources, e.g. image, css and javascript:
<html>
<head>
    ...
    <link rel="stylesheet" href="${resource('/css/main.css')}">
    <script src="${resource('/js/jquery.min.js')}"></script>
</head>
<body>
    <img src="${resource('/img/logo.jpg')}"/>
    ...
</body>
</html>
tocPath
Create a link to the table of contents page:
<a href="$tocPath">Table of Contents</a>

Configuration

Gaiden provides settings for generating the document in 'GaidenConfig.groovy'. You can customize behavior by changing settings.

title
Base title of page.
tocTitle
The title of TOC.
templateFilePath

The path of template file.

default: templates/layout.html

tocFilePath

The path of TOC file.

default: pages/toc.groovy

tocOutputFilePath

The path of TOC output file.

default: toc.html

pagesDirectoryPath

The path of page source files directory.

default: pages

staticDirectoryPath

The path of static files directory.

default: static

outputDirectoryPath

The path of directory to be outputted a document.

default: build

inputEncoding

The encoding of input Markdown resource.

default: UTF-8

outputEncoding

The encoding of output document.

default: UTF-8

templatePath (deprecated)

Please use templateFilePath instead.

tocPath (deprecated)

Please use tocFilePath instead.

tocOutputPath (deprecated)

Please use tocOutputFilePath instead.

pagesDirectory (deprecated)

Please use pagesDirectoryPath instead.

staticDirectory (deprecated)

Please use staticDirectoryPath instead.

outputDirectory (deprecated)

Please use outputDirectoryPath instead.

NOTE: The encoding of GaidenConfig.groovy must be same as the file.encoding system property. If you want to use another encoding, you can use JAVA_OPTS or GAIDEN_OPTS to pass JVM options to Gaiden as follows, for Unix:

$ export GAIDEN_OPTS="-Dfile.encoding=Shift_JIS"

for Windows:

> set GAIDEN_OPTS="-Dfile.encoding=UTF-8"

ToC

Create pages/toc.groovy file which defines document structure if you need a table of contents. You can write it with DSL support as follows:

"introduction.md"(title: "Introduction")
"quickstart/quickstart.md"(title: "Quick Start")

This file also defines the section titles using the title attribute. If you have nested pages, you can use block:

"introduction.md"(title: "Introduction") {
    "introduction/whatis.md"(title: "What is Gaiden?")
    "introduction/install.md"(title: "Install")
}
"quickstart/quickstart.md"(title: "Quick Start") {
    "quickstart/addingcontent.md"(title: "Adding content")
}

Markdown

If you don't know the Markdown, please refer to Markdown Syntax Guide at Daring Firebal.

Gaiden uses PegDown as a Markdwon library under the hood. In addition, Gaiden provides some syntax support.

Image

You can use an absolute path from a static resource directory in a path of image syntax. For example:

![alt text](/img/some-image.png)

Gaiden automatically generates relative a path from an absolute path which is specified.

License

Gaiden is licensed under the terms of the Apache License, Version 2.0

gaiden's People

Contributors

ganta avatar suzukima avatar yamkazu avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.