Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/doriantaylor/rb-md-noko

In goes Markdown, out pops Nokogiri.
https://github.com/doriantaylor/rb-md-noko

Last synced: 24 days ago
JSON representation

In goes Markdown, out pops Nokogiri.

Awesome Lists containing this project

README

        

# MD::Noko: in goes Markdown, out comes Nokogiri

## Synopsis

```ruby
require 'md-noko'

mdnk = MD::Noko.new
doc = mdnk.ingest File.open('lolwut.md')

# or

doc = mdnk.ingest <` element which you can pass a URL,
* Creates a hierarchy of `` elements and places headings
and content inside,
* If the document contains exactly one `

` which is the very first
thing in the file, it is copied into the ``, and removed from
the document body if determined to be redundant (i.e. unless it
contains markup elements and not strictly text),
* A `
` element containing exactly one nested
`
` element is converted into a single ``,
* Images on their own paragraph are transformed into a ``,
* Text nodes not descendants of `
` are whitespace-normalized and

indentation is repaired.

The embedded `Redcarpet::Markdown` instance has the following flags set:

* `:tables`
* `:fenced_code_blocks`
* `:quote`
* `:highlight`

These are currently not exposed.

## Installation

The usual:

$ gem install md-noko

Or, [download it off rubygems.org](https://rubygems.org/gems/md-noko).

## Contributing

Bug reports and pull requests are welcome at
[the GitHub repository](https://github.com/doriantaylor/rb-md-noko).

## Copyright & License

©2018 [Dorian Taylor](https://doriantaylor.com/)

This software is provided under
the [Apache License, 2.0](https://www.apache.org/licenses/LICENSE-2.0).