DEV Community

Maxime Guilbert
Maxime Guilbert

Posted on • Updated on

Presentation of "Markdown-Processor"

Today, we won't speak about a open source tool or talk about how to do something.

Today, I'm proud to present you a personal project: "Markdown-Processor"


Presentation

What is Markdown-Processor ?

Markdown-Processor is a npm CLI to help you to generate HTML or PDF from Markdown files.

Why creating a new CLI to do it?

For two reasons :

  • to be extensible
  • to be able to choose a theme!

To be extensible

One thing I really want is to be able to add elements if needed. (Like liquid tags or completly new tags) You will see later that I already have one extension applied.

To be able to choose a theme

Depending if you are working, writing a book, writing some notes for your next tabletop rpg session..., you may need a specific theme.

So here it is! Currently, 3 themes are available :

  • default
  • dark
  • rpg

And you already can create and use yours!

If you want to add your theme to the project, don't hesitate to do a Pull Request! 😉


Demo

Setup

First, you need to install it with the following command

npm i markdown-processor
Enter fullscreen mode Exit fullscreen mode

If you want to generate some PDF files, install pagedjs and pagedjs-cli too.

npm install -g pagedjs-cli pagedjs
Enter fullscreen mode Exit fullscreen mode

Commands

Process the TEST.md process (by default it will be an HTML file with a timestamped name)

md-processor process -f "TEST.md"
Enter fullscreen mode Exit fullscreen mode

Process multiple files

md-processor process -f "TEST.md" -f "TEST2.md"
Enter fullscreen mode Exit fullscreen mode

Use a specific theme

md-processor process -f "TEST.md" -t "rpg"
Enter fullscreen mode Exit fullscreen mode

Create a pdf file

md-processor process -f "TEST.md" -t "rpg" -o pdf
Enter fullscreen mode Exit fullscreen mode

Extensions

Here is the first extension that we have : Have differents styles of blockquotes

If it's a classic message, an info, an alert or a warning, I don't want to have exactly the same display. So, with a simple element on the first line, we are now able to have more customizations available.

Normal

> Normal
Enter fullscreen mode Exit fullscreen mode

blockquote normal

Info

> **[INFO]**
> Info
Enter fullscreen mode Exit fullscreen mode

blockquote info

Warning

> **[WARNING]**
> Warning
Enter fullscreen mode Exit fullscreen mode

blockquote warning

Alert

> **[ALERT]**
> Alert
Enter fullscreen mode Exit fullscreen mode

blockquote alert


I hope you enjoyed this quick presentation. 🍺

You need to know that I haven't talked about all the options available (add a table of content, process a full folder of markdown files...) and a lot of other elements will come.

So if you want to have other posts to describe all the functionalities, please leave a comment to let me know.


Links

Top comments (0)