Socket
Socket
Sign inDemoInstall

wholesome.md

Package Overview
Dependencies
31
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    wholesome.md

A markdown parser for Reddit-flavored Markdown


Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Install size
0.995 MB
Created
Weekly downloads
 

Readme

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

Last updated on 29 Apr 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc