npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

markdown-it-reddit-supsubscript

v2.0.1

Published

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

Downloads

24

Readme


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