KD2 FW

SkrivLite

SkrivLite is a lightweight and one-file implementation of the Skriv markup language, see http://markup.skriv.org/ for the details on the markup.

Why a different implementation?

  • SkrivLite has no dependency whatsoever and can be use as-is in a project without depending on Packagist or other dependencies.
  • SkrivLite is 25KB in one file, SkrivML original implementation is 256KB in 51 files, and even 316KB in 62 files if you count its dependency on WikiRenderer.
  • SkrivLite has ~800 lines of code or ~1000 counting the helper, SkrivML has more than 2600 lines, or even ~3700 with WikiRenderer.
  • It was fun to make!
  • It's useful to have a different implementation.
  • Memory usage is 2.3 times less than SkrivML original implementation.
  • Up to 2 times faster too.

What differs from the main SkrivML parser:

  • no smileys and symbols shortcuts (this is a choice, extend the class if you want to add this)
  • ability to allow HTML (if enabled, you should filter tags before passing the text to SkrivLite and use Tidy to make the code valid after SkrivLite returned the text)
  • allowing simple HTML inline tags by default like kbd, samp, abbr, big, small, sup, sub, etc.
  • optional support for metadata headers, as per https://github.com/fletcher/MultiMarkdown/wiki/MultiMarkdown-Syntax-Guide
  • support for keyboard notation: Ctrl = Ctrl
  • no integration with GeShi for code highlighting, use your own callback to highlight the code (a sample highlight method is provided)
  • better security on outgoing links (filtering javascript and XSS attemps)
  • named extension parameters: <<lipsum paragraphs=5>>

Known bugs

  • Lists parser conflict: [f028dd3305]