Giter Site home page Giter Site logo

merkki's Introduction

merkki

Clojars Project

A Clojure(Script) library for rendering Markdown formatted strings

Usage

merkki is a semi-opinionated set of functions for generating Markdown formatted strings. In addition to individual functions for various types of Markdown syntax, it also provides the markdown function itself, which takes a vector of elements and returns a Markdown-formatted string.

To use it, add this to your lein dependencies:

[merkki "0.2.1"]

Merkki's markdown syntax is in the form of nested vectors, which can be tagged with keywords to indicate specific markup. For example, the following code:

(require '[merkki.core :refer [markdown]])

(markdown
  [[:uh2 "Example"]
   "This is an example text"
   [:hr]
   [:ul
    "Here's"
    "A"
    "List"]])

Will produce the following Markdown output:

Example
-------

This is an example text

***

* Here's
* A
* List

New tags can be defined by extending the multimethod md-tag found in the merkki.tags namespace.

Development

Testing is configured for both Clojure and ClojureScript (via doo).

To run Clojure tests do:

lein test

For ClojureScript, tests are provided for both node and browser targets. Node tests can be run with lein doo node node-test provided node is installed.

For browser testing, doo uses Karma, which you will need to install via npm. See the doo readme for instructions on how to set this up, and install the necessary Karma plugins for the browsers you wish to target. Once installed, you can do lein doo [browser-name] browser-test, provided you've installed the Karma plugin for that browser. Note that browser testing with doo/Karma is still in the experimental phase and has a few quirks; in particular it doesn't tend to run the tests automatically on first run, you will need to make and save some minor change to trigger the auto-run.

License

Copyright © 2016 John S. Berry III

Distributed under the Eclipse Public License v1. See LICENSE for more information.

merkki's People

Contributors

jarcane avatar

Stargazers

Dominic Monroe avatar Vic avatar Petrus Theron avatar Burin Choomnuan avatar  avatar Julien avatar KARASZI István avatar John avatar  avatar  avatar  avatar Brandon Adams avatar Krisztián Szabó  avatar Antoine Kalmbach avatar Alcides Viamontes E avatar Ralf Schmitt avatar Tommi Reiman avatar

Watchers

James Cloos avatar  avatar  avatar

merkki's Issues

Handle nested list items

We would switch to this implementation of Markdown generation instead of our own one for github-changelog, if it would support arbitraliry nested list items in ul's or ol's.

In our current library, we can do this:

(println (li (apply str "a" (map li ["a" "b" "c"]))))

* a
  * a
  * b
  * c

Support ClojureScript

There's really almost nothing in this that shouldn't work in both CLJ and CLJS, so it really should probably be converted to .cljc so it can be called from ClojureScript as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.