项目作者: NoRedInk

项目描述 :
Plaintext documentation viewer and editor with diagram support
高级语言: Ruby
项目地址: git://github.com/NoRedInk/localdoc.git
创建时间: 2016-01-07T23:48:06Z
项目社区:https://github.com/NoRedInk/localdoc

开源协议:BSD 3-Clause "New" or "Revised" License

下载


localdoc

This is a Rails 3 Engine for navigating, viewing and editing local plaintext documents.

  • Markdown files: rendered using markdown-it
    • With special extension for Mermaid diagram support
  • Everthing else: rendered as a code block highlighted with highlight.js

Installation

In your Gemfile, add this gem within the group that makes sense for you. For example:

  1. group :development, :staging do
  2. gem 'localdoc', github: 'NoRedInk/localdoc', branch: 'stable'
  3. end

Follow the gem’s post installation message to generate the required assets for your development environment.

In config/routes.rb, mount the engine at the path of your choice. For example:

  1. if Rails.env.development? || Rails.env.staging?
  2. namespace :dev do
  3. mount Localdoc::Engine, at: "/docs"
  4. end
  5. end

In config/initializers/localdoc.rb, specify the path to the root of your documentation files. For example:

  1. if Rails.env.development? || Rails.env.staging?
  2. Localdoc.document_root = "docs"
  3. # You can also pass options to markdown-it and Mermaid:
  4. Localdoc.markdown_options = {
  5. breaks: true,
  6. mermaid: {
  7. sequenceDiagram: {
  8. mirrorActors: true
  9. }
  10. }
  11. }
  12. end

How to write Mermaid diagrams

Write your diagram in a code block and specify mermaid as the language.

  1. ```mermaid
  2. graph LR
  3. Hello-->World
  4. ```

Note to contributors: how to push a new version

As a pre-alpha product, this gem is not published on rubygems.org yet.
To make new changes available, push to the stable branch.