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

dyn-markdown

v1.4.0

Published

📖 easily handle markdown files in nodejs based projects, including add, update and delete fields dynamically.

Readme

:trumpet: Overview

Easily handle dynamic fields in markdown files, such as quantity fields or even tables in nodejs based projects.

In the related section and also in dependents you can see some projects using this package.

:dart: Features

   ✔️ easily add, update or remove markdown fields (numbers, tables, etc);    ✔️ powerful and simple way to deal with tables;    ✔️ allow you to see the current content before you update the file;    ✔️ allow you to see which dynamic fields were found;    ✔️ provides an easy way to get content form json files;    ✔️ works in typescript, javascript commonjs and javascript modules.

:warning: Requirements

In order to use this project in your computer, you need to have the following items:

  • npm: To install the package. Npm is installed alongside nodejs;
  • nodejs: To actually run the package.

:bulb: Usage

Installation

To install dyn-markdown in your computer, simple run this command:

# install the dyn-markdown npm package
$ npm install dyn-markdown

Available methods

The dyn-markdown comes with the following commands list:

Usage example

In the examples folder there is a intermediary example that uses most of the package features.

In short words, we have a articles.json and we want to update two dynamic fields in a readme file called articles.md:

  • quantity of articles
  • table with article informations, such as title and author;

In the articles.md we have to specify every dynamic field with a special html-like syntax, as it is shown below:

...

<h3 align="center">
  <!-- <DYNFIELD:ARTICLES_NUMBER> -->
  ALL MY ARTICLES (4)
  <!-- </DYNFIELD:ARTICLES_NUMBER> -->
</h3>

...

To update all the desired fields, we create a typescript file with the following content:

import { DynMarkdown, MarkdownTable, getJson } from '../src/index';

type RowContent = MarkdownTable['cellContent'][]; // optional, I put here just to teach how to get the type of table rows

const articlesJson = getJson('./examples/articles.json');
const articlesMarkdown = new DynMarkdown('./examples/articles.md');

const articlesTable = new MarkdownTable();

const headerContent: RowContent = [
  { content: 'date', width: 120 },
  { content: 'title', width: 600 },
  { content: 'motivation', width: 300 },
  { content: 'tech', width: 100 }
];

articlesTable.setHeader(headerContent);

articlesJson.forEach((item: any) => {
  const { date, title, motivation, tech } = item;
  const bodyRow: RowContent = [
    { content: date, align: 'center' },
    { content: title, align: 'center' },
    { content: motivation, align: 'left' },
    { content: tech.join(', '), align: 'center' }
  ];
  articlesTable.addBodyRow(bodyRow);
});

articlesMarkdown.updateField('NODEJS_UTILITIES', articlesTable.getTable('date'));
articlesMarkdown.updateField('ARTICLES_NUMBER', `ALL MY ARTICLES (${articlesJson.length})`);
articlesMarkdown.saveFile();

After run the above typescript code, all the content will be replaced.

:wrench: Development

Development setup

If you want to contribute to the project it is recommended to also install the following tools:

  • git: To work with version controlling;
  • vscode: Useful for editing the code. You can choose a similar editor as you wish.

To setup this project in your computer run the following commands:

# Clone this repository
$ git clone https://github.com/lucasvtiradentes/dyn-markdown

# Go into the repository
$ cd dyn-markdown

# Install dependencies
$ npm install

# Run the typescript code in development mode
$ npm run dev

After you make the necessary changes, run these commands to check if everything is working fine:

# Compiles the typescript code into javascript
$ npm run build

# Run the available unit tests
$ npm run test

# Run the compiled code in production mode
$ npm run start

Used technologies

This project uses the following thechnologies:

:books: About

Related

  • js-boilerplates: boilerplates repository that uses this package to update boilerplate lists;
  • my-tutorials: my github tutorials repository that uses this package to update articles, projects and other stuff;

License

This project is distributed under the terms of the MIT License Version 2.0. A complete version of the license is available in the LICENSE file in this repository. Any contribution made to this project will be licensed under the MIT License Version 2.0.

Feedback

If you have any questions or suggestions you are welcome to discuss it on github issues or, if you prefer, you can reach me in my social media provided bellow.