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 🙏

© 2026 – Pkg Stats / Ryan Hefner

md-confluence

v1.0.2

Published

A Node.js library to publish markdown files to Atlassian Confluence

Readme

md-confluence

A Node.js library and CLI tool to publish markdown files to Atlassian Confluence.

Features

  • 🚀 Publish single markdown files or multiple files using configuration
  • 📝 Converts markdown to Confluence storage format
  • 🔄 Only updates pages when content has changed (uses SHA256 hashing)
  • 🎯 Supports custom code block rendering for Confluence
  • 📦 Available as both a library and CLI tool
  • ✨ TypeScript-ready with JSDoc annotations

Installation

Global Installation (CLI usage)

npm install -g md-confluence

Local Installation (library usage)

npm install md-confluence

CLI Usage

Environment Variables

Set these environment variables:

export CONFLUENCE_DOC_EMAIL="[email protected]"
export CONFLUENCE_DOC_TOKEN="your-api-token"
export CONFLUENCE_URL="https://your-company.atlassian.net"

Commands

Publish multiple pages using default pages.json

md-confluence

Publish multiple pages using custom config file

md-confluence --config pages.json

Publish single file

md-confluence --file README.md --page-id 123456789

Use custom Confluence URL

md-confluence --url https://mycompany.atlassian.net

Show help

md-confluence --help

Configuration File Format

Create a pages.json file mapping Confluence page IDs to markdown files:

{
  "123456789": "README.md",
  "987654321": "docs/api-guide.md",
  "456789123": "docs/deployment.md"
}

Library Usage

Basic Example

import { ConfluenceConfig, publishMarkdownToConfluence } from 'md-confluence';

const config = new ConfluenceConfig({
  userEmail: '[email protected]',
  apiToken: 'your-api-token',
  confluenceUrl: 'https://your-company.atlassian.net',
  repoUrl: 'https://github.com/your-org/your-repo' // optional
});

const result = await publishMarkdownToConfluence(
  '123456789', // Confluence page ID
  './README.md', // Path to markdown file
  config
);

console.log(result);

Publish Multiple Pages

import { ConfluenceConfig, publishMultiplePages } from 'md-confluence';

const config = new ConfluenceConfig({
  userEmail: '[email protected]',
  apiToken: 'your-api-token',
  confluenceUrl: 'https://your-company.atlassian.net'
});

const pageMapping = {
  '123456789': 'README.md',
  '987654321': 'docs/api-guide.md'
};

const results = await publishMultiplePages(pageMapping, config);
console.log(results);

Convert Markdown Only

import { convertMarkdownToConfluence } from 'md-confluence';

const markdownContent = '# Title\n\nSome content';
const { title, html } = convertMarkdownToConfluence(markdownContent);

console.log('Title:', title);
console.log('HTML:', html);

API Reference

ConfluenceConfig

Configuration class for Confluence connection.

const config = new ConfluenceConfig({
  userEmail: 'string',      // Required
  apiToken: 'string',       // Required  
  confluenceUrl: 'string',  // Required
  repoUrl: 'string'         // Optional
});

Functions

  • publishMarkdownToConfluence(pageId, filePath, config, options) - Publish single file
  • publishMultiplePages(pageMapping, config, options) - Publish multiple files
  • convertMarkdownToConfluence(markdown, options) - Convert markdown to Confluence format
  • getLatestVersion(pageId, config) - Get latest version of Confluence page
  • updateContent(contentBody, config) - Update Confluence page content
  • calculateContentHash(content) - Calculate SHA256 hash of content
  • loadPagesConfig(configPath) - Load pages configuration from JSON file

Development

Install Dependencies

npm install

Run Tests

npm test
npm run test:coverage
npm run test:watch

Lint Code

npm run lint
npm run lint:fix

Run CLI in Development

npm run dev  # Shows help
npm start -- --help  # Also shows help

Getting Confluence API Token

  1. Go to Atlassian Account Settings
  2. Click "Create API token"
  3. Give it a label and click "Create"
  4. Copy the token (you won't be able to see it again)

Getting Confluence Page ID

  1. Go to your Confluence page
  2. Click "..." → "Page Information"
  3. The page ID is in the URL: /pages/viewinfo.action?pageId=PAGE_ID

License

MIT

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Run tests and linting
  6. Submit a pull request