Skip to content

Sinova/DoubleDown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DoubleDown

Super Lightweight Markdown-Style Parser

Overview

DoubleDown is a Markdown-inspired text parser primarily intended for sites with comment sections that might benefit from simple styling (e.g. Reddit). It uses a syntax similar to Markdown but with a much more restricted feature set, slight syntax modifications, and built-in HTML escaping to facilitate faster, simpler, and safer parsing.

Installation

npm install doubledown

Usage

import doubledown from 'doubledown';

const formatted_text = doubledown('Hello, **World!**'); // Hello, <strong>World!</strong>

Syntax

Apart from links, all features are triggered by surrounding text with a set of markers. As the double in DoubleDown implies, all markers are made up of sets of two characters. For instance, the bold marker is ** and can be used like so: **This text is bold.**

Feature Input Output
Link [Click Here](https:https://google.com) <a rel=" noreferrer noopener" target="_blank" href="https:https://google.com">Click Here</a>
Code ##var foo = 123;## <code>var foo = 123;</code>
Keyboard Shortcut $$Ctrl + S$$ <kbd>Ctrl + S</kbd>
Quote @@This text is a quote@@ <blockquote>This text is a quote</blockquote>
Bold **This text is bold** <strong>This text is bold</strong>
Italic //This text is italicized// <em>This text is italicized</em>
Underline __This text is underlined__ <u>This text is underlined</u>
Strikethrough ~~This text is struck through~~ <s>This text is struck through</s>
Subscript %%This text is a subscript%% <sub>This text is a subscript</sub>
Superscript ^^This text is a superscript^^ <sup>This text is a superscript</sup>

About

Super Lightweight Markdown-Style Parser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published