Skip to content

sublinks/sublinks-markdown

Repository files navigation

GitHub tag (latest SemVer) GitHub issues License GitHub stars

A markdown parser with rules for frontends of sublinks. Used to easily add markdown support compatible with the standard sublinks frontend.

About

Sublinks markdown is a package that can be imported into your frontend and then used to add markdown support through one function call. All of the markdown rules used in the standard sublinks frontend are supported meaning your users will see the same things as users using the standard frontend without you needing to implement every single rule yourself.

Install

This package is ESM only. To install with npm use:

npm i sublinks-markdown

Usage

To convert text from markdown syntax into html use the mdToHtml function

import { mdToHtml } from "sublinks-markdown";

const html = await mdToHtml("## Hello World", "example.com")

The first argument is the markdown you want converted and the second is the instance of the user currently interacting with the frontend (so things such as relative links populate properly).

Features