GithubHelp home page GithubHelp logo

sinedied / hads Goto Github PK

View Code? Open in Web Editor NEW
168.0 7.0 28.0 1.14 MB

:books: Markdown superpowered documentation for Node.js

License: MIT License

JavaScript 85.09% CSS 5.22% Pug 9.68%
mermaid markdown gfm documentation wiki knowledgebase nodejs offline server hacktoberfest

hads's Introduction

Hey it's Another Documentation Server! (hads)

NPM version Build Status Node version XO code style Downloads License

The master of hell docs

Hads is a fast Node.js based web server allowing to browse, search and edit documentation written in Markdown.

screenshot

Features:

  • No configuration needed
  • Github-like presentation
  • GFM (Github Flavoured Markdown)
  • Automatic indexation and search
  • In-browser editor
  • Table of contents using Markdown extension [[toc]]
  • Navigation index using Markdown extension [[index]]
  • Diagrams and flowcharts using Mermaid syntax
  • Drag'n drop images
  • 100% offline
  • Custom CSS style

Usage

npm install -g hads
hads -o

Your browser will open http://localhost:4040 and display your project documentation.

Command-line options

Usage: hads [root dir] [options]

Options:
  -p, --port        Port number to listen on       [default: 4040]
  -h, --host        Host address to bind to        [default: "localhost"]
  -i, --images-dir  Directory to store images      [default: "images"]
  -o, --open        Open default browser on start
  -r, --readonly    Read-only mode (no add or edit feature)
  -e, --export      Export static HTML             [default: "./public"]
  --help            Show this help

If no root dir is specified, ./ will be used.

Extras

Home page

The server will automatically search for a file named index.md, readme.md or README.md on the specified documentation root and will use it as your home page.

You can customize the CSS style in a file named custom.css.

Table of contents

The special text [[toc]] will be replaced by the table of contents of the markdown document, based on headings.

Navigation index

The special text [[index]] will be replaced by the full navigation index of all markdown files found under the specified root dir. File and folder names will be humanized for better readability.

It is particularly useful on the home page to provide an overview of the available documentation for your project.

The sorting of each index level is as follows:

  1. Any README.md, readme.md, or index.md is always at the top.
  2. All files and folders that are prefixed with a number (e.g. 001-abc and 002 mno and 003_xyz) are next, sorted by their respective prefix numbers. Note that the prefix numbers are stripped out in the index.
  3. All remaining files, sorted by their name.
  4. All remaining folders, sorted by their name.

Mermaid Diagrams and flowcharts

You can use the Mermaid syntax to insert diagrams and flowcharts directly in your markdown, but using code blocks with the mermaid language specified, like this:

```mermaid
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
```

Mermaid configuration can be overridden on a given page using the global variable MERMAID_CONFIG in a <script> tag, for example:

<script>
MERMAID_CONFIG = { theme: 'forest' };
</script>

Updates

See changelog here

Variants

hads's People

Contributors

damiendube avatar dependabot[bot] avatar fabala avatar igorskh avatar lcfvs avatar luiza-cicone avatar mnzaki avatar notmyself avatar nsainaney avatar semantic-release-bot avatar sinedied avatar thomasleveil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hads's Issues

Opt out of first heading in TOC

Rendering the first H1 level title heading in my README.md document as the outermost element in the TOC is very irrelevant.

It would be nice to be able to configure it so it starts on the second level of headers.

PlantUML Support

Would be really nice to have PlantUML supported. This along with DOT is the default diagramming supported in all Markdown editors in Jetbrains IDEs like IDEA and Webstorm.

Antislashed paths

Hi again,

There is some antislash problems on:

  • Link provided on file upload
  • Search results

(Probably due to unfixed Windows paths)

Directory should link to README.md when using [[index]]

I feel like [[index]] could be improved.

In my documentation structure, all sub-directories have a README.md or index.md. I use this file to describe the content of that directory.

When generating [[index]], I would like all directories to be a link to the README.md/Index.md file if one exists.

Static HTML Last Modified

A last modified timestamp should show at the top of static documentation like it does when using the server.

Mermaid upgrade

Hi Yohan,

Do you think it would be possible to upgrade Mermaid? I have several little bugs in Gantt rendering that may be fixed by the latest version of Mermaid.

Update css

Update css with latest github's style.

Support gitlab navigation (without .md extension)

Hi,

Github navigation use relative path to pages without the .md extension.
With Hads, those relative paths do not work.
Would it be possible to find the file even if the .md extension is not specified ?

Thank you

Mermaid mindmap

Is it possible to use the mermaid mindmap to be displayed on hads ?.

It i try with latest version, it gives the error:

Syntax error in graph
mermaid version 9.3.0

The markdown to test it:

mindmap
Root
    A
      B
      C

npm audit report a Critical issue

Hello,

When I run npm audit with hads in version 1.6.1, I have this report:

│ Critical │ Command Injection
│ Package │ open
│ Patched in │ No patch available
│ Dependency of │ hads [dev]
│ Path │ hads > open
│ More info │ https://nodesecurity.io/advisories/663

Did you plan to fix this issue?

Thanks in advance for your answer.
Damien

Project with hads will not `npm install` -- ENOENT: no such file or directory, chmod node_modules/highlight.js/tools/build.js

Looks like some deprecated dependencies. Even though this is in highlight.js, it seemed to trace back to here.

npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Use uuid module instead
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: The major version is no longer supported. Please update to 4.x or newer

vulnerability CVE-2020-7598 is introduced by package minimist

Hi, a vulnerability CVE-2020-7598 is introduced in [email protected] via:
[email protected][email protected][email protected]

However, optimist is a legacy package, which has not been maintained for about 8 years.
Is it possible to migrate optimist to other package to remediate this vulnerability?

I noticed several migration records in other js repo for optimist:

  1. in handlebars, version 4.7.3-->4.7.4, migrate optimist to yargs via commit
  2. in db-migrate, version 1.0.0-beta.2-->1.0.0-beta.3, migrate optimist to yargs via commit
  3. in http-server, version 0.12.1-->0.12.2, deprecated optimist and directly use minimist via commit

Thanks.

Static HTML Searching

Let the user search across static documentation like he can when using the server.

Reduce dependencies

I find the number of dependencies quite big for such a project, it would be nice to slim down on this side, especially for the frontend dependencies which includes tons of stuff which is not needed.

Maybe start by adding a build step for the frontend stuff, so they can be moved to devDependencies at least.

UTF-8 support in the index.

I'm writing my docs in Spanish and I'd love to be able to add accents to the filenames. Currently the characters with accent marks are not displayed in the index, they're omitted.

Detect external changes and hot-reload markdown

It would be really nice if we could hot-reload the markdown files as they are changed in an external editor. Would allow to use an external editor and the browser showing the rendered result side-by-side without the edit-switch-refresh workflow.

Ordering in [[index]]

Would be nice to define some ordering in [[toc]]. I saw one Markdown system (don't remember which) that allowed files to be prefixed with a number xyz- (e.g. 001-intro, 002-background), and then while injecting the ToC would strip that prefixes out. Ordering maintained without extra effort.

Static html export

Add an option to generate static html files from the documentation, like --export <out_folder>

hads -o ,Unhandled rejection Error: ENOENT: no such file or directory

Hi,all.
what is the problem,when i run this commands.

lcy@debian8:~$ npm install -g hads
/home/lcy/DEV_LIB/node-v6.10.0-linux-x64/bin/hads -> /home/lcy/DEV_LIB/node-v6.10.0-linux-x64/lib/node_modules/hads/bin/hads
/home/lcy/DEV_LIB/node-v6.10.0-linux-x64/lib
└── [email protected] 

lcy@debian8:~$ hads -o 
Unhandled rejection Error: ENOENT: no such file or directory, stat '/home/lcy/.kde/socket-debian8'
    at Error (native)

<--- Last few GCs --->

   89267 ms: Mark-sweep 1324.2 (1408.9) -> 1323.9 (1414.9) MB, 719.4 / 3.1 ms [allocation failure] [GC in old space requested].
   89960 ms: Mark-sweep 1323.9 (1414.9) -> 1323.9 (1414.9) MB, 692.9 / 3.3 ms [allocation failure] [GC in old space requested].
   90670 ms: Mark-sweep 1323.9 (1414.9) -> 1325.9 (1408.9) MB, 709.2 / 3.7 ms [last resort gc].
   91378 ms: Mark-sweep 1325.9 (1408.9) -> 1327.9 (1408.9) MB, 707.9 / 3.3 ms [last resort gc].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x1cb573acfb51 <JS Object>
    1: indexOf [native string.js:~68] [pc=0x1ddfad760b22] (this=0x253da50a479 <String[158]: /home/lcy/poky/build/tmp/work/x86_64-linux/acl-native/2.2.52-r0/acl-2.2.52/include/sys/sys/acl/acl/sys/sys/sys/acl/acl/acl/sys/sys/sys/sys/sys/sys/buildmacros>,z=0xf349893c2f1 <String[1]\: \x00>,A=0x1cb573a04381 <undefined>)
    2: arguments adaptor frame: 1->2
    3: /* anonymous */ [/home/lcy/DEV_LIB/n...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [node]
 2: 0x10983ec [node]
 3: v8::Utils::ReportApiFailure(char const*, char const*) [node]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
 5: v8::internal::Factory::NewRawOneByteString(int, v8::internal::PretenureFlag) [node]
 6: v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [node]
 7: v8::internal::StringMatch(v8::internal::Isolate*, v8::internal::Handle<v8::internal::String>, v8::internal::Handle<v8::internal::String>, int) [node]
 8: v8::internal::Runtime_StringIndexOf(int, v8::internal::Object**, v8::internal::Isolate*) [node]
 9: 0x1ddfad2092a7
Aborted

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.