New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

markdown-it-reddit-supsubscript

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-it-reddit-supsubscript

Reddit's super/subscript syntax for markdown-it by ${Mr.DJA}.

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

markdown-it-reddit-supsubscript

npm

Reddit's super/subscript syntax for markdown-it by ${Mr.DJA}.


This is a plugin for markdown-it uses markdown-it-regexp to render superscripts like those on Reddit: ^superscript ^(superscript), and subscripts with a similar syntax: ~superscript ~(superscript).

In fact Reddit doesn't support subscripts, but people need them so they are available here. Smart move huh? ^-^

⚠ A note about v2.0.0:

This version introduces breaking changes, it has a completely new API and uses a different implementation. The plugin doesn't depend on markdown-it directly anymore, instead, it uses the method .renderInline() from the md object that is already passed as an argument to the plugin function. Also, it depends on the fork @gerhobbelt/markdown-it-regexp now since it's more advanced than the original project.

It's highly recommended to upgrade! The previous version is functional but not suitable for production use.

Installation

From NPM:

npm install markdown-it-reddit-supsubscript --save
const markdownItRedditSupsubscript = require("markdown-it-reddit-supsubscript")

This works on Node. Use a module bundler if you want it for browser.

Browser:

A pre-built version for browser is available over JsDeliver CDN:

<script src='https://cdn.jsdelivr.net/gh/iMrDJAi/markdown-it-reddit-supsubscript/dist/markdown-it-reddit-supsubscript.min.js'></script>

It will be available as window.markdownItRedditSupsubscript:

const markdownItRedditSupsubscript = window.markdownItRedditSupsubscript

⚠ Warning!

The previous version used a different name for the plugin: markdownitRedditSupSubScript. Make sure to update it to markdownItRedditSupsubscript when upgrading!

Usage

The usage is way simpler than it was in v1.0.0:

const markdownit = require('markdown-it')
const markdownItRedditSupsubscript = require('markdown-it-reddit-supsubscript')

const options = { // Default options. Use `false` to disable unwanted rules
    superscriptParenthesized: true, // To enable ^(superscript)
    superscript: true, // To enable ^superscript
    subscriptParenthesized: true, // To enable ~(supscript)
    subscript: true // To enable ~supscript
}

const md = markdownit.use(
    markdownItRedditSupsubscript, // Plugin
    options // Options are not required
)

function renderMarkdown(text) { // A function to convert markdown to html
    return md.render(text)
}

Preview:

image

Enjoy <3.

Dependents Projects

Wanna use markdown-it-reddit-supsubscript on your next big project? Let me now and it will be listed here! :)

  • iMrDJAi-MDE: Open source, Simple, Easy to use and fully featured Markdown editor - by me.

Notes

  • This package has made by ${Mr.DJA}.
  • Do you like it? Gimme a star ⭐ and I'll smile 😃.
    GitHub Repo stars
  • You are free to suggest anything and I will try to add it soon if I found it useful.
  • If you found any mistake (including the README file) feel free to help to fix it.
  • Please report any bugs.
  • Made with ❤ in Algeria 🇩🇿.

License

MIT © iMrDJAi

Keywords

FAQs

Package last updated on 05 Feb 2022

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