npm.io
1.0.0 • Published 7 years ago

markdown-functions

Licence
MIT
Version
1.0.0
Deps
1
Size
8 kB
Vulns
0
Weekly
0

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