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

mm-mark

v0.2.4

Published

Markdown and Html Converter

Downloads

450

Readme

mm-mark

ESM Only

md-html


Convert Markdown to HTML

Mmmark : Convert Md to Html with my own Prism.js code highlight and Mathjax extenstions of Showdown.Js.

[!NOTE] This package focus on convert markdown to html . If you want more, recommended to use Showdown.js


Main dependencies bundled license information.

1. Showdown.js

Showdown.js is a powerful JavaScript library used for converting Markdown into HTML. It's a key dependency in our project, providing the core functionality of our Markdown to HTML conversion.

2. JS-YAML

JS-YAML is a JavaScript implementation of YAML, a human-friendly data serialization standard. In our project, it's used for parsing YAML front matter in Markdown files.

3. Other dependencies

  • Prism.Js for code block highlight.
  • Mathjax for math support.
  • tsup for typescript compile and bundle.

npm version

Install from npm

npm i mm-mark
yarn add mm-mark
pnpm i mm-mark

Documentations

import Mmmark from "mm-mark";

1. Mmmark.renderHtml

1.1 Descriptions

Renders the given text as HTML using the Showdown library.

1.2 Options

1.2.1 text: string | Markdown Contents.
1.2.2 RenderOptions
1.2.2.1 string | oiptional | default - "vs"

Name of Prism.js themes for code block highlight.

| Available Themes | | --------------------- | | actom-dark | | cb | | coldark-dark | | dark | | holi-theme | | duotone-earth | | duotone-forest | | duotone-light | | duotone-sea | | duotone-space | | funky | | ghcolors | | gruvbox-light | | laserwave | | lucario | | night-owl | | okaidia | | one-dark | | one-light | | solarized-dark-atom | | synthwave84 | | tomorrow | | twilight | | vs | | vsc-dark-plus | | z-touch |

1.2.2.2 languages?: string [ ] | optional | default - See below.

Prism Js supported languages , its perform prismjs loadLanguages() ,prismjs will load the default languages: markup, css, clike and javascript and Mmmark will preload others additional languages are as follows. Do not use with Webpack or another bundler, as this will cause Webpack to include all languages and plugins.

| Preloaded Languages | | ------------------- | | python | | py | | typescript | | ts | | yaml | | yml | | toml | | sass | | scss | | rust | | ruby | | rb | | jsx | | tsx | | php | | markdown | | md | | latex | | tex | | haskell | | hs | | json | | asciidoc | | adoc | | bash | | shell | | c | | csharp | | cs | | dotnet | | cpp | | java |

1.2.3 metadata: boolean | optional | fefault - false

If you used metadata (as follows) , set it true.

---
title: Hello World
date: 2023-04-12
---

1.3 Return

1.3.1 HTML: string | The rendered HTML string

1.4 Example

import Mmmark from "mm-mark";
const md = "# Hello World";
// convert to markdown to html
const converter = Mmmark.renderHtml(Options);

console.log(html);

/* 
-- others outputs that provided by Mmmark.

  <h1 id="hello-world">Hello World</h1>

-- others outputs that provided by Mmmark.
*/

2. Mmmark.getFrontmatter

2.1 Descriptions

Generates data and content from the markdown file.

2.2 Options

2.2.1 text: string | Markdown content

2.3 Return

2.3.1 data: Record<string, unknown> | YAML front matter in Markdown files.
2.3.2 content: string | Raw markdown content.

2.3 Example

example.md

---
title: Hello World
date: 2023-04-12
---

# Hello World!
import Mmmark from "mm-mark";
import fs from "fs";

const md = fs.readFileSync("example.md", "utf-8");

const data = Mmmark.getFrontmatter(md).data
const content = Mmmark.getFrontmatter(md).content