Socket
Book a DemoInstallSign in
Socket

marksmithjs

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marksmithjs

A library to convert markdown to HTML.

1.1.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Marksmith

Marksmith is a lightweight npm library written in TypeScript for converting Markdown documents into HTML. It provides a simple and efficient way to seamlessly integrate Markdown parsing and HTML generation into your JavaScript or TypeScript projects.

Features

  • Convert Markdown documents to HTML with ease.
  • Fully written in TypeScript for improved type safety and developer experience.
  • Lightweight and dependency-free, ensuring minimal impact on your project's bundle size.

Supported Markdown Elements

Marksmith currently supports the elements mentioned below. With further releases, it'll support more markdown elements.

Note: Currently, there's only one level of parsing of bold, italic, code tags. Nested parsing will be supported in future versions.

  • Headings (#, ##, ###, etc.)
  • Bold (**text**)
  • Italic (*text*)
  • Code (`code`)
  • Links ([text](url))
  • Images (![alt text](url))
  • Lists (both ordered and unordered)
  • Blockquotes (> text)
  • Horizontal rules (---)
  • Inline code (`code`)
  • Table

Installation

You can install Marksmith via npm:

npm i marksmithjs

Usage

import { markdownToHtml } from 'marksmithjs';

const markdownText = '# Hello, World!\n\nThis is a *Markdown* example.';

try {
    const htmlOutput = markdownToHtml(markdownText);
    console.log(htmlOutput);
} catch (err) {
    console.error("Markdown syntax not valid");
}

The output will be a div tag with all the markdown converted to HTML within the tag.

An error is thrown when the input markdown does not follow markdown rules such as incomplete bold / italic / code tags.

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

Keywords

markdown

FAQs

Package last updated on 16 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.