1.1.1 • Published 2 years ago

markdowner-cli v1.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

logo

Codacy grade

markdowner-cli

A command-line tools crafted with love ❤️ and code 💻 to make your life easier when working with markdown-based documentation.

What can Markdowner CLI do for you ?

  1. An easy way to create documents for your code, using code 😀.
  2. Don't rewrite your code in your README/MD files anymore.
  3. Automatically generate different parts your document just by using comments, and markdowner off course 🤪.
  4. More features to be added .... 👍.

How to use

npm install -g markdown-cli
markdowner READE.md

Analogy

Add comments as follows:

<!-- MD[<TYPE>](<source path with extension>)[<OPTIONS>] -->

<!-- MD[/<TYPE>] -->

Supported Types

TypeDescription
CODE_SNIPPETReplace with content form a file with syntax highlighting and code block.
JSONGet json content with desired options with path of the key/s to extract.
MAKEFILEGet content from Makefile (use .mk extension with makefile). EIther the whole file or a set of commands.

We have two tpe of options

OptionExampleDescription
START END1:5Start from 1st line and read up to the 5th line.
CSVname,version,, [author9.url,]comma separated values of the entities you want to extract.

Features

Replaces MD comments with either generated values of content from other files.

Replace Code blocks with syntax highlighting

Simply substitute content from a file to your document.

replaces:

<!-- MD[CODE_SNIPPET](test/assets/snippets/js/test.js)[] -->

<!-- MD[/CODE_SNIPPET] -->

with:

<!-- MD[CODE_SNIPPET](test/assets/snippets/js/test.js)[] -->

    ```js
    const a = 10
    const b = 20
    const c = a + b
    console.log(c)
    ```

<!-- MD[/CODE_SNIPPET] -->

When substituting form a json file, specify the json paths to pick data from

replaces:

replaces:

<!-- MD[CODE_SNIPPET](package.json)[version,] -->

<!-- MD[/CODE_SNIPPET] -->

with

<!-- MD[CODE_SNIPPET](package.json)[version,] -->

    ```json
    {
        "version": "1.1.0"
    }
    ```

<!-- MD[/CODE_SNIPPET] -->

When substituting from MAKEFILE use .mk extension.

replaces:

<!-- MD[MAKEFILE](test/assets/MAKEFILE.mk)[] -->

<!-- MD[/MAKEFILE] -->

with:

<!-- MD[MAKEFILE](test/assets/MAKEFILE.mk)[] -->

    ```bash
    all_files_and_dir:
        ls -la
    .phony: run_image

    run_image:
        docker run -p 5000:80 --rm \
        --name $(MODULE_NAME) \
        --env-file=./config.env $(ACCOUNT_NAME)/$(MODULE_NAME):$(VERSION_TAG)
    .phony: run_image
    ```

<!-- MD[/MAKEFILE] -->

Specify what command you want to pull form the MAKEFILE.

replaces:

<!-- MD[MAKEFILE](test/assets/MAKEFILE.mk)[run_image,] -->

<!-- MD[/MAKEFILE] -->

with:

<!-- MD[MAKEFILE](test/assets/MAKEFILE.mk)[run_image,] -->

    ```bash
        docker run -p 5000:80 --rm \
        --name $(MODULE_NAME) \
        --env-file=./config.env $(ACCOUNT_NAME)/$(MODULE_NAME):$(VERSION_TAG)
    ```

<!-- MD[/MAKEFILE] -->

Specify line number to read from in a file

replaces:

<!-- MD[CODE_SNIPPET](test/assets/testFIle.txt)[2:3] -->

<!-- MD[/CODE_SNIPPET] -->

with:

<!-- MD[CODE_SNIPPET](test/assets/testFIle.txt)[2:3] -->

    ```
        Enim ea excepteur cillum irure culpa laborum anim pariatur nulla Lorem.
        Laborum non cillum laborum excepteur occaecat aliquip occaecat ipsum irure in reprehenderit sunt proident.
    ```

<!-- MD[/CODE_SNIPPET] -->

Parse json file just ot get the data in text format not code block

replaces:

version:

<!-- MD[JSON](package.json)[version,] -->

<!-- MD[/JSON] -->

with:

version:

<!-- MD[JSON](package.json)[version,] -->

"1.0.2"

<!-- MD[/JSON] -->

Hope you like this.

Developer:

LinkedIn GitHub