- Markdown files are always up to date
- Examples are always correct
- Shields (a.k.a. badges) are auto-generated
- Commonly used README sections are auto-generated using info from
- Plugins can be used for tons of additional features
The readme you are currently reading uses mos! Here's how the shields are generated:
<!--@shields('npm', 'travis', 'coveralls', 'gitter')-->[![npm version]()]() [![Build Status]()]() [![Coverage Status]()]() [![Gitter]()]()<!--/@-->
Table of Contents
- CLI Usage
- Mos plugins
- Who uses mos?
- Dev Dependencies
Install mos globally:
npm i -g mos
Make mos configure your
package.json will be updated with some new dependencies and
You can also install mos directly:
npm i -D mos
You'll have to configure the
script property in your
package.json to use mos (see above).
The great thing is, that the template and the markdown file are actually the same file! The code snippets are written inside markdown comments, which are invisible when reading the generated markdown file.
Lets use mos to write a readme with some dynamic data. Have you ever renamed your package and forgotten to update the readme? Good news! With mos it won't ever happen again:
If you view your readme now, it will be empty. However, you have the code that can insert the title in your readme. All you have to do now is to run
mos in a terminal.
Once you've run
mos, the readme will look like this:
Now your readme has both the code that generates the content and the content itself. However, only the content is visible after the readme is generated to HTML by GitHub or npm. Awesome!
Regenerate the markdown files if they are out of date.
Test the markdown files. Fails if can't generate one of the markdown files or one of the markdown files is out of date. It is recommended to add this command to the
scripts.test property of
Optional TAP output
Mos can generate TAP output via
--tap option for use with any TAP reporter.
mos test --tap | tap-nyan
NOTE: the CLI will use your local install of mos when available, even when run globally.
In the usage example the
package variable was used to access the package info. The variables available in the markdown scope are declared by mos plugins. The
package variable is created by the package-json plugin.
There are a few mos plugins that are installed with mos by default:
Do you want to write a new one? Read the plugins readme.
Configuring the default plugins
It is possible to pass options to the default mos plugins via the
mos property in the
To disable a default plugin, pass
false instead of a config object:
Who uses mos?
- @zkochan/read-pkg-up: Read the closest package.json file
- @zkochan/tap-diff: The most human-friendly TAP reporter
- babel-runtime: babel selfContained runtime
- chalk: Terminal string styling done right. Much color.
- glob: a little globber
- loud-rejection: Make unhandled promise rejections fail loudly instead of the default silent fail
- magic-hook: Extends functions with pre hooks.
- meow: CLI app helper
- mos-init: Add mos to your project
- mos-plugin-dependencies: A mos plugin that creates dependencies sections
- mos-plugin-ejs: A mos plugin that executes embedded js in markdown files
- mos-plugin-example: A mos plugin that combines example code files with their output
- mos-plugin-installation: A mos plugin for creating installation section
- mos-plugin-license: A mos plugin for generating a license section
- mos-plugin-markdownscript: A mos plugin that adds markownscript helpers to the markdown scope
- mos-plugin-package-json: A mos plugin that makes the package.json available in the markdown scope
- mos-plugin-shields: A mos plugin for creating markdown shields
- mos-plugin-snippet: A mos plugin for embedding snippets from files
- mos-plugin-toc: A mos plugin for creating Table of Contents
- mos-processor: A markdown processor for mos
- normalize-newline: Normalize the newline characters in a string to
- normalize-path: Normalize file path slashes to be unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes.
- rcfile: Loads library configuration in all possible ways
- relative: Get the relative filepath from path A to path B. Calculates from file-to-directory, file-to-file, directory-to-file, and directory-to-directory.
- resolve: resolve like require.resolve() on behalf of files asynchronously and synchronously
- tape: tap-producing test harness for node and browsers
- update-notifier: Update notifications for your CLI app
- babel-cli: Babel command line.
- babel-plugin-add-module-exports: Fix babel/babel#2212
- babel-plugin-syntax-object-rest-spread: Allow parsing of object rest/spread
- babel-plugin-transform-es2015-spread: Compile ES2015 spread to ES5
- babel-plugin-transform-object-rest-spread: Compile object rest and spread to ES5
- babel-plugin-transform-runtime: Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals
- babel-preset-es2015: Babel preset for all es2015 plugins.
- babel-register: babel require hook
- chai: BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
- core-js: Standard library
- cz-conventional-changelog: Commitizen adapter following the conventional-changelog format.
- eslint-plugin-standard: ESlint Plugin for the Standard Linter
- execa: A better
- ghooks: Simple git hooks
- istanbul: Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests
- mocha: simple, flexible, fun test framework
- mos-plugin-readme: A mos plugin for generating README
- semantic-release: automated semver compliant package publishing
- validate-commit-msg: Script to validate a commit message follows the conventional changelog standard
What does mos mean?
It means Markdown on Steroids!