0.0.5 • Published 8 years ago

decentraleyes-markdown v0.0.5

Weekly downloads
12
License
MIT
Repository
github
Last release
8 years ago

decentraleyes-markdown

The decentraleyes-markdown microservice reference implementation

Implementation

An internal API and public HTTP service request are implemented by the module. The marked JavaScript library is used to render markdown to HTML. All available options are exposed except for callback, highlight and renderer. They are required to be specified as JavaScript functions, and that's just something decentraleyes is not going to let you do.

API

The decentraleyes-markdown microservice exposes an internally-callable public API.

render (content, options, callback);

Renders the provided content in Markdown syntax to HTML using the provided options. The otional callback allows the render to occur asynchronously, calling the callback with the rendred content (when available).

HTTP Requests

The decentraleyes-markdown microservice exposes public HTTP requests.

method: GET url: /

Returns this README.md document rendered as HTML. You can view a demo here.

method: POST url: /

A document in Markdown syntax may be submitted using a POST request to the root service URL (/). The document will be parsed as Markdown, rendered as HTML and returned.

No enclosing document is added, the content is simply returned as valid rendered HTML content with the intent that it will be further integrated into an existing HTML document with its own styling.

Content Body (accepts: text/plain, text/markdown)

A text document in the syntax of Markdown to be rendered as HTML by this microservice. And, sure...text/markdown isn't a formal type. I give zero shits. Decentraleyes will accept it.

Query Options

Options to be passed to the markdown renderer when rendering the body document as HTML.

gfm (Boolean: true|false, default: true)

Github Flavored Markdown. When true, Github flavored markdown may be used in source documents.

tables (Boolean: true|false, default: true)

Github flavored tables. When true, Github-style tables may be used in source documents.

breaks (Boolean: true|false, default: false)

Github line breaks. When true, Github-specific line breaks may be used in source documents.

pedantic (Boolean: true|false, default: false)

Don't fix any of the original markdown bugs or poor behavior.

sanitize (Boolean: true|false, default: true)

Ignore any HTML that has been input.

signature (Boolean: true|false, default: true)

Controls whether decentraleyes adds its signature to the output HTML. When true, the signature will be added.

smartLists (Boolean: true|false, default: true)

Use smarter list behavior than the original markdown.

smartypants (Boolean: true|false, default: false)

Use "smart" typograhic conventions and punctuation for quotes and dashes. I'm told that enabling this option helps a corporate project's UX designer drink less alcohol.