Coder Social home page Coder Social logo

kerrycobb / nimibook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pietroppeter/nimibook

0.0 0.0 0.0 1.28 MB

A port of mdbook to nim(ib)

Home Page: https://pietroppeter.github.io/nimibook/

License: MIT License

Nim 25.63% Mustache 16.63% CSS 29.45% Rust 2.19% JavaScript 26.10%

nimibook's Introduction

nimibook

nimibook is a port of mdbook to Nim, powered by nimib. Nimibook allows to create a nice looking book from nim code and markdown, making sure that nim code is running correctly and being able to incorporate code outputs in the final book. An example book is nimibook documentation itself.

mdBook is a command line tool and Rust crate to create books using Markdown (as by the CommonMark specification) files. It's very similar to Gitbook, which is a command line tool (and Node.js library) for building beautiful books using GitHub/Git and Markdown (or AsciiDoc).

nimib is a Nim library to convert your Nim code and its outputs to html documents. The html output can be easily customized thanks to nim-mustache, and this is what allows it to use it to build nimibook. nimib documents are normal nim files which use nimib library to produce an output document.

The Markdown dialect supported by both nimib and nimibook is the subset of Github Flavored Markdown provided by nim-markdown. For a quick reference of supported syntax see the [cheatsheet].

Status

nimibook currently provides minimal functionality to create a book and support a local CLI mode.

Installation

To install Nimibook simply use : nimble install nimibook

Usage

  1. Write your content using nimib or simple markdown files in the book folder.

  2. Use the Table of Content (ToC) DSL to link chapters to content in nbook.nim. Example :

import nimibook

var book = newBookFromToc("Dummy Book", "book"): # Create a new book called "Dummy", whose content is in the folder "book"
  section("Dummy", "index"): # Create a new section called "Dummy", its content is the file "index.nim". Notice how the .nim extensions is optionnal
    entry("Simple example", "page_1.nim") # Create a new entry called "Simple example", its content is the file "page_1.nim"

nimibookCli(book)

See nimibook or Nimibook repo for more documentations and examples.

  1. Generate your very own CLI tools or use Nimble tasks with nim c -d:release nbook.nim.
  • ./nbook init to init your book structure. This command must be ran at least once.
  • ./nbook build to build your book.
  1. Whenever your Table of Content changes (add/remove files, changes sections organization), recompile your nbook and run the build command : nim c -d:release nbook.nim && ./nbook build
  • It is also doable in one command : nim r -d:release nbook.nim build
  • You don't need to call the init command again.
  • Rinse and repeat until your ToC is done ! Then you can just edit files and call build without recompiling.

Tips and Tricks

  • Each book requires its own ToC and thus will be its own CLI Apps
  • nbook.nim is the default name used - it is possible to use another name.
  • Multiple books nbook.nim cannot share the same folder. Instead, either split them into two separate books, or merge them into one.
  • Some commands :
    • ./nbook clean will remove generated files and restart from a clean state.
    • ./nbook update will update assets and mustache template.
    • These two commands will modify installed files, use them with caution if you customized files locally.

Analytics

This website is tracking analytics with plausible.io, a lightweight and open-source website analytics tool with no cookies and fully compliant with GDPR, CCPA and PECR. Analytics for this website are publicly available here. You can opt out from analytics tracking with standard ad-blocking or typing localStorage.plausible_ignore=true in browser console.

nimibook's People

Contributors

clonkk avatar hugogranstrom avatar moigagoo avatar pietroppeter 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.