GithubHelp home page GithubHelp logo

tarsbase / purescript-markdown-smolder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hgiasac/purescript-markdown-smolder

0.0 1.0 0.0 24 KB

Render purescript-markdown to purescript-smolder.

License: Other

PureScript 100.00%

purescript-markdown-smolder's Introduction

purescript-slamdown-smolder

Pursuit ComVer Build Status

This library is forked from original one, with up-to-date dependencies and breaking changes fixed. I also add simple customized options:

  • HTML class for markups ul, ol, p, h1, h2,...
  • Customized code block renderer

Installation

bower install purescript-slamdown-smolder

Example

compileMd' :: forall e. ToMarkupOptions e -> String -> String 
compileMd' options input =
  either identity (toMarkup' options >>> render)
  (parseMd input :: Either String (SlamDownP String))

compileMd :: String -> String
compileMd = compileMd' defaultToMarkupOptions

compileMd "# Hello"
-- <h1 id=\"Hello\">Hello</h1>

compileMd' (defaultToMarkupOptions { hideHeadingId = true }) "# Hello"
-- <h1>Hello</h1>

Quick Reference

Module Text.Markdown.SlamDown.Smolder

ToMarkupOptions

type ToMarkupOptions e = 
  { hideHeadingId :: Boolean
  , hClasses :: Array (Tuple Int String)
  , olClass :: String
  , ulClass :: String
  , pClass :: String
  , renderFencedCodeBlock :: String -> List String -> Markup e 
  }

Convert options, you can set classes into common markups If you don't want to set id in headings, set hideHeadingId If you need to render code block content to another markup templates, define function renderFencedCodeBlock option

defaultToMarkupOptions

Default convert options

defaultToMarkupOptions :: forall e. ToMarkupOptions e

toMarkup

toMarkup :: forall a e. SlamDownP a -> Markup e

Render purescript-markdown to purescript-smolder, with default options.

toMarkup'

toMarkup' :: forall a e. ToMarkupOptions e -> SlamDownP a -> Markup e

Convert Smolder markup from Slamdown Markdown with options

purescript-markdown-smolder's People

Contributors

hgiasac avatar alexmingoia avatar karls avatar

Watchers

 avatar

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.