10 releases (4 stable)

new 1.3.0 Sep 2, 2024
1.2.0 Aug 6, 2024
0.36.1 Jul 24, 2024
0.35.0 Jul 13, 2024
0.33.3 Jul 9, 2024

#294 in Development tools

Download history 220/week @ 2024-07-06 92/week @ 2024-07-13 212/week @ 2024-07-20 219/week @ 2024-07-27 166/week @ 2024-08-03 14/week @ 2024-08-10 1/week @ 2024-08-17 131/week @ 2024-08-31

150 downloads per month

Custom license

98KB
1.5K SLoC

Logo

New MarkDown CLI

New way to write in markdown

License Version

NMD stands for New MarkDown, or for friends, Nicola MarkDown (if Stephen Bourne can name a shell, why can't I name mine NMD?)

Getting Started

Do you want migrate from Markdown to New Markdown easily and quickly? Read how to do that using CLI!

TL;DR

cargo install nmd

nmd generate dossier -p dossier/input/path -f -w

nmd dossier -p dossier/input/path add -d new-document.nmd

nmd build -i input/path

Installation

You can install NMD using Cargo or downloading last release from Github.

cargo install nmd

NMD CLI

Generate a new dossier

To generate a new dossier you can use the following command:

nmd generate dossier -p dossier/input/path

There are many flags that you can use in combination with generate dossier. For example, if you want force the generation you can use -f, or if you want a welcome page you can use -w.

nmd generate dossier -p dossier/input/path -f -w

The Git support is planned, but not implemented yet. You can only add .gitkeep files in assets directories using -k.

-n permits to specify dossier name.

Markdown to New Markdown

You can easily convert a standard Markdown file in a New Markdown dossier using --from-md <md-file-path> option.

Add a new document

To add a new document you can use the following command:

nmd dossier -p dossier/input/path add -d new-document.nmd

If the document name doesn't have nmd extension, it will be added automatically.

You can add more than one document at the same time:

nmd dossier -p dossier/input/path add -d new-document-1.nmd -d new-document-2.nmd -d new-document-3.nmd
Reset dossier configuration
nmd dossier -p dossier/input/path reset [ -p ]

-p reset flag to preserve documents list.

Build

You can build a dossier or a single file through build command.

The only mandatory option is the input path. It can be a path to a directory (dossier) or a file.

nmd build -i input/path

compile command has a lot of options. You could specify the output format using -f <format> (e.g. html, which is the default), the output path with -o <output-path> or the theme using -t <theme>. The available themes are:

  • light
  • dark
  • vintage
  • scientific
  • none
nmd compile -f html dossier -i dossier/input/path -o artifact/output/path

Moreover, if you watch dossier files and compile them if something changes, you should use watcher mode (-w option). Watcher mode compile dossier if any change is captured. Changes are captured only if a minimum time is elapsed. To set minimum time use --watcher-time option.

--fast-draft to create a fast draft of dossier, generally compiler takes less time to generate it.

--parallelization to parallelize work (default is single thread).

-s <document1> -s <documentN> to compile only a subset of documents in dossier configuration list.

In the end, if you are writing in NMD and you want a preview, you could compile with -p option. -p renders a preview in a web server on 127.0.0.1:1234 (--preview-scraping-interval <interval> to set client scraping interval in milliseconds).

--embed-local-image, --embed-remote-image, --strict-image-src-check and --embed-local-image to manage images parsing.

You can use --nuid to add NUID.

Analyze

You could want analyze a dossier or a document before build it. analyze command print on stdout the corresponding JSON.

nmd analyze -i input/path

You can use --nuid to add NUID or --pretty to print pretty formatted JSON.

Develop

Develop check list

Author

Nicola Ricciardi

Contributing

If you would like to contribute to the development of the NMD compiler, please follow contribution guidelines.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Dependencies

~25–39MB
~591K SLoC