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

@nence/markdown

v1.0.0

Published

Simple implementation markdown renderer.

Downloads

15

Readme

@nence/markdown

  • Simple implementation markdown renderer.

Feature

  • Support for diagrams such as mermaid, pintora, plantuml.
  • Support for import.
  • By customizeng the class, you can read markdown files from the database.
  • By customizing the class, the output of link and image tags can be changed.

Install

npm install @nence/markdown

Run example

  • Download and extrace source
    • https://github.com/codesmith666/markdown/archive/refs/heads/main.zip
  • Install the Dev Containers plugin in VSCode and open the directory.
  • Open a terminal in VSCode...
    • npm install
    • cd example
    • npm install
    • npm run dev
    • Open localhost 8080 in a browser.

Sample

  • About css.nence
    • see https://github.com/codesmith666/markdown/blob/main/example/css.nence.ts
  • About css.prism
    • see https://github.com/codesmith666/markdown/blob/main/example/css.prism.ts
import express from "express";
import { css_prism } from "./css.prism";
import { css_nence } from "./css.nence";
import { MarkdownFS } from "../src/index.js";

const selfPath = import.meta.url;
const app = express();

app.get("/", async (req, res) => {
  // Create root path.Put markdown file here.
  let root = "";
  if (selfPath.startsWith("file://")) root = selfPath.slice(7);
  if (selfPath.endsWith("/index.ts")) root = root.slice(0, -9);
  root += "/markdown";

  // 0.Since you are using express, run `npm install express`.
  // 1.Specify the document root to the MarkdownFS class.
  // 2.Get the name of the markdown file to be displayed from the query string.
  //   The extension may be omitted.
  // 3.Rendering yields HTML (to be processed by await or then).
  // 4.Returns a response by specifying an html tag or a head tag.
  const md = new MarkdownFS(root);
  const fn = (req.query["md"] as string | undefined) || "main";
  const body = await md.render(fn);
  const html = `<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <style type="text/css">
        ${css_prism}
        ${css_nence}
    </style>
    </head>
  <body>
    ${body}<br/>
    EOF
  </body>
</html>
`;

  res.end(html);
});

const port = 8080;
app.listen(port, () => {
  console.log(`Listening on port ${port}`);
});

Apply

  • If derived from the Book class, markdowns can be obtained from sources other than the file system.
  • You can see it in the MarkdownFS implementation.
    • https://github.com/codesmith666/markdown/blob/main/src/markdown/MarkdownFS.ts

The comments in the source

  • The comments in the source are not yet fully written, and most are in Japanese.
  • I'll get it into English eventually(Use deepl).