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

@jonpalmisc/pmt

v1.6.4

Published

A robust solution for creating PDF media with Pug.

Downloads

6

Readme

PMT: Pug Media Tool

PMT is a robust solution for creating PDF media with Pug.

Version License

Motivation

This project is my attempt to replace LaTeX in my toolchain. I often use LaTeX to create pretty documents, presentations, etc. - any scenario in which structured documents are desired.

This project is still very much under construction. I don't intend to make any breaking changes, but this is your standard "stuff might break" warning.

Install

PMT is available via NPM. You can install it like any other NPM package:

$ npm i -g @jonpalmisc/pmt

Usage

The most simple usage secenario is as follows, where <file> is the the path to your input:

$ pmt <file>

This will process your input file (Pug) and produce a PDF adjacent to it using the internal (Chromium-based) PDF engine.

If you would like to use an alternate HTML-to-PDF engine such as Prince or WeasyPrint, you can instruct PMT to produce HTML output instead with the -x or --html flags:

$ pmt -x <file>

For advanced usage, use the -h or --help flags for more information.

Examples

One thing PMT is sorely lacking is example documents, etc. While they are not written in Pug and do not leverage PMT's syntax, the PrinceXML Samples and WeasyPrint Samples should serve to demonstrate the level of visual fidelity PMT is capable of, as they utilize similar technology.

I aim to create some examples and add them to the repo soon! Unfortunately, most of my existing work done in PMT is not publicly-sharable.

Default plugins

A handful of "plugins" are included by default. You can learn more about them in the following sections.

Markdown

You can write Markdown in your documents using the :markdown filter:

:markdown
  # An exciting heading

  With an even more exciting paragraph

SCSS

You can write SCSS in your documents or include SCSS files using the :scss filter:

style
  include:scss local.scss

  :scss
    html {
      font-family: sans-serif;
    }

You can also leverage the (somewhat limited) "standard library" of styles from either inline SCSS or from included files:

style
  :scss
    @import "std/base"

Extra plugins

The plugins in the sections below are also included with a standard install, but are not enabled by default. You can enable them via the -p flag. See the usage information for more details.

MathJax

You can write math equations to be automatically typeset by MathJax:

p Look, here's an inline square root: $\sqrt{x}$.

p Below, you can find a display equation:
p $$\int_a^b 6x \,dx = 3x^2 \Big|_a^b$$

Mermaid

Support for creating diagrams with Mermaid is included. You can define your diagrams in the body of a :mermaid filter:

:mermaid
  graph LR
    A[Start] --> B[End]

Hint: You must explicitly set your document's doctype (doctype html), otherwise Mermaid may not work as expected.

Smart quotes

The smart quotes plugin will automatically replace "dumb quotes" with typographically correct quote characters.

Syntax highlighting

There are two built-in plugins for syntax highlighting: one for Highlight.js and one for Prism.js, named highlight and prism, respectively. If you enable these plugins, you must use the default highlighting stylesheet (found in the include folder) or bring your own. Otherwise, it will appear as if nothing is happening! See the documentation for each highlighter for more info on customization.

Page polyfill

Chrome doesn't support some of the more fancy paged CSS features, but you can enable them through a polyfill with the pages plugin, which uses Paged.js under the hood.

License

Copyright © 2020 Jon Palmisciano. See LICENSE.txt for more information.