markdown-functions

1.0.0 • Public • Published

markdown-functions

Build Status Greenkeeper badge codecov

Installation

npm install --save markdown-functions

What is markdown-functions?

markdown-functions are javascript functions to apply markdown formatting syntaxes into a textarea. They each accept an HTMLTextAreaElement. The functions intelligently handle selected text when applying the formatting, and for text styling transforms, they intelligently toggle on/off.

Demo

markdown-functions power (markdown-textarea-editor)[https://github.com/craigmichaelmartin/markdown-textarea-editor] which has a demo https://craigmichaelmartin.github.io/markdown-textarea-editor/

API

  • toggleBold(body: HTMLTextAreaElement)
  • toggleItalics(body: HTMLTextAreaElement)
  • toggleStrikethrough(body: HTMLTextAreaElement)
  • toggleH1(body: HTMLTextAreaElement)
  • toggleH2(body: HTMLTextAreaElement)
  • toggleH3(body: HTMLTextAreaElement)
  • toggleH4(body: HTMLTextAreaElement)
  • addTab(body: HTMLTextAreaElement, url: string)
  • addImage(body: HTMLTextAreaElement, url: string)
  • addLink(body: HTMLTextAreaElement)
  • addUnorderedList(body: HTMLTextAreaElement)
  • addOrderedList(body: HTMLTextAreaElement)

TODO

  • Add tests

Package Sidebar

Install

npm i markdown-functions

Weekly Downloads

5

Version

1.0.0

License

MIT

Unpacked Size

8.4 kB

Total Files

4

Last publish

Collaborators

  • craigmichaelmartin