This content originally appeared on DEV Community and was authored by Maxime Guilbert
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
If you want to generate some PDF files, install pagedjs and pagedjs-cli too.
npm install -g pagedjs-cli pagedjs
Commands
Process the TEST.md process (by default it will be an HTML file with a timestamped name)
md-processor process -f "TEST.md"
Process multiple files
md-processor process -f "TEST.md" -f "TEST2.md"
Use a specific theme
md-processor process -f "TEST.md" -t "rpg"
Create a pdf file
md-processor process -f "TEST.md" -t "rpg" -o pdf
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
Info
> **[INFO]**
> Info
Warning
> **[WARNING]**
> Warning
Alert
> **[ALERT]**
> 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
- GitHub project : https://github.com/Adaendra/markdown_processor
- NPM page : https://www.npmjs.com/package/markdown-processor
This content originally appeared on DEV Community and was authored by Maxime Guilbert
Maxime Guilbert | Sciencx (2021-08-17T11:12:03+00:00) Presentation of “Markdown-Processor”. Retrieved from https://www.scien.cx/2021/08/17/presentation-of-markdown-processor/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.