Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wholesome.md

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

wholesome.md

A markdown parser for Reddit-flavored Markdown

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Wholesome.md

A markdown parser for Reddit-flavored Markdown.

Examples

HTML

import stringify from "rehype-stringify";
import remark from "remark";
import remark2rehype from "remark-rehype";
import wmd from "wholesome.md";

remark()
  .use(wmd)
  .use(remark2rehype)
  .use(stringify)
  .process("Hello, ^(World)!", (err, file) => {
    if (err !== null) throw err;
    console.log(file.toString());
  });

JSX

import { createElement, ReactElement } from "react";
import ReactDOM from "react-dom";
import rehype2react from "rehype-react";
import remark from "remark";
import remark2rehype from "remark-rehype";
import wmd from "wholesome.md";

const mark = remark()
  .use(wmd)
  .use(remark2rehype)
  .use(rehype2react, { createElement });

function Markdown({ content }: { content: string }) {
  return mark.processSync(content).result as ReactElement;
}

ReactDOM.render(
  <Markdown content="Hello, ^(World)!" />,
  document.querySelector("#root")
);

Plain

import stringify from "rehype-stringify";
import remark from "remark";
import remark2retext from "remark-retext";
import wmd from "wholesome.md";

remark()
  .use(wmd)
  .use(remark2retext)
  .use(stringify)
  .process("Hello, ^(World)!", (err, file) => {
    if (err !== null) throw err;
    console.log(file.toString());
  });

Options

remark().use(wmd, {
  // Replace spoilers with █. Useful for <meta> tags or notifications
  replaceSpoiler: true,

  userURL: "https://old.reddit.com/user/{}",
  subredditURL: "https://old.reddit.com/r/{}",
});

Keywords

FAQs

Package last updated on 29 Apr 2021

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc