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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@marko/prettyprint

v3.0.1

Published

Prettyprint Marko template files in the syntax of your choice

Readme

Prettyprint Marko template files in the syntax of your choice.

CLI

Getting Started

npm install @marko/prettyprint
marko-prettyprint template.marko

or

npx @marko/prettyprint template.marko

Example

# Pretty print a single file.
marko-prettyprint template.marko --syntax html

# Pretty print all Marko files in a directory.
marko-prettyprint . --syntax html

Options

  • --eol: The EOL sequence (defaults to require('os').EOL)
  • --filename: The path to the template being pretty printed (required unless prettyPrintFile(filename, options) is used)
  • --indent: The indent string (defaults to a String with four spaces)
  • --noSemi: If set, will format JS without semicolons.
  • --singleQuote: If set, will prefer single quotes.
  • --maxLen: The max line length (defaults to 80, set to -1 to disable)
  • --configFiles: Should search for .marko-prettyprint/.editorconfig files? (defaults to true)
  • --syntax: The syntax to use. Can either be "html" or "concise" (defaults to "html")

API

Installation

npm install @marko/prettyprint

Example

import {
    prettyPrintFile,
    prettyPrintSource,
    prettyPrintAST
} from "@marko/prettyprint";

prettyPrintFile("./path-to-marko-file", options) // -> Output Marko file string.

prettyPrintSource("<div x=1/>", options) // -> Output Marko file string.

const ast = compiler.parseRaw(...);
prettyPrintAST(ast, options) // -> Output Marko file string.

Configuration files

.marko-prettyprint config file

When pretty printing a Marko template, @marko/prettyprint will search up the directory tree looking for a .marko-prettyprint file. This file should be in the JSON format. For example:

my-project/.marko-prettyprint:

{
  "indent": "\t",
  "syntax": "concise"
}

.editorconfig file

@marko/prettyprint also supports EditorConfig files for configuring maxLen, indent and eol. For example:

my-project/.editorconfig:

root = true

[*.marko]
indent_style = space
indent_size = 8
end_of_line = lf