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

mathdoc

v0.0.4

Published

A markdown extension for scientific writings.

Readme

Mathdoc

A markdown extension for mathematical or scientific documents.

Extensions

Mathematical expression powered by Mathjax

Text areas with prefix $ and surfix $ will be interpreted as inline mathematical expressions. In order to put a mathematical expression as a block, you can change the prefix and surfix as $$

(e.g.)

Let $x_0$ be a real number that maximizes $f(x)$. Since $f$ is globally differentiable, we have
$$\frac{df}{dx}(x_0) = 0$$

Boxes for definition, theorem, proof, ...

We can insert a CSS-empowered beautiful box to describe definition, theorem, proof and others into our documents easily. Here is an example:

def. Rational preference
    A preference $R$ over $X$ is rational if and only if
    (1) For any $x, y \in X$, it holds $(x,y) \in R$ or $(y,x) \in R$
    (2) For any $x, y, z \in X$, if $(x,y) \in R$ and $(y,z) \in R$, then $(x,z) \in R$

Install

Nodejs

npm install -g mathdoc

Python

pip3 install mathdocpy

NOTE: mathdocpy is a simple wrapper of the parser written in NodeJS. Therefore, you are required to install npm and mathdoc by npm.

API

Nodejs Command Line

Compile

In your terminal app, you can get the HTML transpilation of your mathdoc markdown document through the standard output.

mathdoc --compile path_to_file

GetAST

If you want to get the abstract syntax tree (AST) of your document in order to process the document in your application, you can get the AST in JSON format as:

mathdoc --getast path_to_file

Python

You can process your mathdoc markdown documents in your Python app through a mathdocpy.mathdoc.Mathdoc object.

from mathdocpy.mathdoc import Mathdoc

file_path = "path/to/your/doc"
doc = Mathdoc(file_path)

Mathdoc objects have the following interfaces:

  • Mathdoc.compile: returns the HTML transpilation of your document as a str object
  • Mathdoc.getAST : returns the abstract syntax tree (AST) in the JSON-like format

Syntax

Document config

Meta data of your document can be stored at the top of the document.

==================================================
title  : Mathdoc example
author : yaufai
tags   : Mathdoc, Documentation
==================================================

Just like the example above, it has the format of key : value. The key can only contain English alphabets and digits.

The meta data do not appear on the compiled documents. So far, in this repository the function of meta data has no use, but apps that depend on Mathdoc may utilize this function.

Interface

Command line tool

mathdoc --getast <target_file> --config-only

This command will only output the config in JSON format.

JS library

let mathdoc = new Mathdoc(target_file)
// To obtain the config object
let config = mathdoc.getConfig()
// To obtain the config in JSON string format 
let config_json = mathdoc.getConfigJSON()

Python

from mathdocpy.mathdoc import Mathdoc
doc = Mathdoc(target_file)
# Obtain the config in dict
config_dict = doc.getConfig()