Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@synion/md-docs

Package Overview
Dependencies
Maintainers
1
Versions
166
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@synion/md-docs

Business driven living documentation static site generator.

  • 1.0.25
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
99
decreased by-23.26%
Maintainers
1
Weekly downloads
 
Created
Source

analyze release npm npm alerts

Product

md-docs is a cli tool which generates a static webiste by resolving files recursivly from a source folder.

This script copies every file and directory from the docs directory into the dist directory and transforms every *.md file into a html file while adding the following features:

  1. Every *.md is transformed in a static web page;
  2. Every *.email.md is transformed in a static document web page;
  3. Every *.message.md is transformed in a static document web page and PDF;
  4. Every index.md is added to the menu;
  5. Every heading is automaticly converted into a container;
  6. Every *.bpmn anchor is automaticly converted into a bpmn.io viewer;fir
  7. Every *openapi.yaml anchor is automaticly converted into a html documentation page;
  8. Every *asyncapi.yaml anchor is automaticly converted into a html documentation page;
  9. Every *.feature anchor is automaticly converted into a feature details list;
  10. Every *.dashboard.yaml anchor is automaticly converted into a BDD dashboard;
  11. Every *.user-task.yaml anchor is automaticly converted into a user-interface;
  12. Every *.puml filer is automaticly converted into an svg image file;
  13. Every *.drawio file is automaticly into an svg image file;
  14. Every *.java, *.cs, *.ts, *.js, *.json, *.py, *.yml, *.yml anchor is automaticly converted in a code block;
  15. Every markdown anchor is automaticly converted into an html link;
  16. Every markdown anchor which starts with an _ is automaticly added to the markdown file;
  17. Every git branch is added to the git menu;
  18. Test executions are automaticly parsed in feature files;
  19. Unsorted list with items which reference the files above are automaticly converted in tab panels;
  20. Images are wrapped in figures;
  21. Images can be alligned by adding align=center or align=left or align=right to the url;
  22. Markdown is transformed into html using markdow-it, the following plugins are installed:

All links are relative so you do not need a webserver.

Class diagram

Architecture

The application is written in node js and implements a plug in architecture. It uses Awilix under the hood for dependency resolving. Plugins can be used by extending App and adding or replacing service registrations.

There are several plugin strategies:

  1. add or change the file parsers;
  2. add or change the html parsers;
  3. add or change the anchor parsers;
  4. change components;
  5. change component render functions;
const App = require('md-docs-cli/app');

module.exports = class MyApp extends App {
  constructor(options) {
    super(options);
  }

  _getServices(options) {
    const services = super(options);

    //Option 1
    services['newFileParser'] = asClass(NewFileParser).singleton();
    services.fileParsers.push('newFileParser');

    //Option 2
    services['newHtmlParser'] = asClass(NewHtmlParser).singleton();
    services.htmlParsers.push('newHtmlParser');

    //Option 3
    services['newAnchorParser'] = asClass(NewAnchorParser).singleton();
    services.anchorParsers.push('newAnchorParser');

    //Option 4
    services.pageComponent = asClass(MyPageComponent).singleton();

    //Option 5
    services.pageComponentRenderFn = asValue((data) => '<html />');

    return services;
  }
}

To get started

npm install @synion/md-docs -g
mkdir ../documentation
cd documentation
mkdir docs
echo "# It works!" > docs/index.md
md-docs
google-chrome dist/index.html

Options

branches only

md-docs -b

Custom theme

You can override all assets files by adding the same files to docs folder: docs/assets/style/custom-theme.css can then be overwritten by a custom theme implementation.

Skip branches

md-docs -s branch1 branch2

To debug

Set the environment to development. All intermediate steps are saved as files in the dist directory.

export NODE_ENV=development

Keywords

FAQs

Package last updated on 11 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc