npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

markpdf

v6.1.0

Published

Markdown to PDF

Downloads

8

Readme

MarkPDF

MarkPDF is a program that transforms a Markdown file to a PDF

Warning: Images must be inside the current directory, like assets/image.png, please, dont use external image links, download and put inside the current directory.

Github

npmjs

Install

Install Node with your packeage manager like sudo apt install nodejs

To install MarkPDF use:

npm install -g markpdf

Exemple

To see this README in a PDF by MarkPDF click here

Usage

To use MarkPDF in a fast way, type markpdf and your Markdown file, simple.

markpdf myExemple.md

Using Themes

To use a personalizated theme, append your theme file name with the -t or --theme argument, like:

markpdf myExemple.md -t myTheme.css

or

markpdf myExemple.md --theme myTheme.css

If you want to use a theme in MarkPDF themes list, you can only write the theme name, like:

markpdf myExemple.md -t dark

See the theme list in the bottom of this README.

An example of theme applied to MarkPDF is this README in a dark theme

specificalling PDF size

If you want to define a specifically format, like A3, A2,etc (the default is A4), put it in the arguments with -f or --format, like:

markpdf myExemple.md -f A5

or

markpdf myExemple.md --format A5

An example of paper format applied to MarkPDF is this README in A5 paper format

Using landscape (horizontal)

If you want to use landscape format (like in slides) you can do it passing -l or --landscape, like

markpdf myExemple.md -l

or

markpdf myExemple.md --landscape

An example of Landscape format applied to MarkPDF is this README in Landscape Format

Using with Bootstrap

MarkPDF accepts any Bootstrap class, like w-100, or pr-5. You can use divs, h1, h2,etc. in for file with Bootstrap, because MarkPDF will understand it.

Switching Path

If you want to switch the output file directory and the pathname (name of the file), use --path or -p like:

markpdf myExemple.md -p MyDir/MyPdf.pdf

or

markpdf myExemple.md --path MyDir/MyPdf.pdf

Page Number

If you want to put a page number in the footer of all pages, use --number or -n, like:

markpdf myExemple.md -n

or

markpdf myExemple.md --number

An example of Page Number applied to MarkPDF is this README with Page Number

Add PDF's Before or After

If you want to add a PDF's (not Markdown) before or after your PDF (Your markdown what you will transform to PDF), you can do it with --before and --after arguments, like:

markpdf myExemple.md --before beforePdf.pdf

and you can pass multiple PDF's

markpdf myExemple.md --after afterPdf.pdf,anotherAfterPdf.pdf

Adding personalizated style with inline CSS in your file

If you need to apply a CSS change, and you don't want to create a theme to do this, you can define this using a div, with your style, like this:

<div style="color:red">
  Now, my text is Red!
  <div></div>
</div>

You can use this to build any style with CSS, using displays, background, color, margin, or anything.

Append CSS Files

To append CSS files, you can use the option -c or -css with the CSS file or multiple files.

markpdf myExample.md -c MyCSSFile.css

or

markpdf myExample.md -css MyCSSFile.css

Themes

The default theme is white, with the h1 centralizated, justified texts,etc. See source code in themes directory, or the links in the footer.

Mpdf (MarkPDF config file)

If you have a project, what uses a certain format, theme and/or landscape, you can define a file called mpdf.json in the main tree of your project, the mpdf.json content have to be like:

{
  "theme": "myTheme.css",
  "format": "A4",
  "landscape": true,
  "path": "pdf/myPdf.pdf",
  "number": true,
  "before": "beforePdf.pdf",
  "after": "afterPdf.pdf"
}

And now, if you use markpdf myExample.md and the mdpdf.json exist, this configs will be applied automaticly to your file. You don't have to pass an argument, like, if you forget the theme argument in mpdf.json, the default theme will be applied.

Creating Themes

If you want to create your theme, create a CSS file with a body class, defining the font-family, background color, color of text,etc. a Table style, styles for h1, h2, h3, etc. And a style for the <code></code> tag. Create themes for MarkPDF is very simple and fast, click in a theme file in section "List of Themes" to see the CSS code.

List of Themes

Default Theme

Dark Theme

Brazilian ABNT Theme

Programmer Theme