Giter Site home page Giter Site logo

mojavelinux / html-pipeline-asciidoc_filter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from asciidoctor/html-pipeline-asciidoc_filter

0.0 2.0 0.0 90 KB

An AsciiDoc processing filter for html-pipeline based on Asciidoctor

License: MIT License

Ruby 100.00%

html-pipeline-asciidoc_filter's Introduction

AsciiDoc filter for html-pipeline

html-pipeline-asciidoc_filter is an AsciiDoc processing filter for html-pipeline based on Asciidoctor.

This filter is used to render AsciiDoc files in GitHub repositories, among other uses. Keep in mind that an HTML sanitization filter is run after this filter, so not all elements in the AsciiDoc document render correctly. We need to improve the output generated by this filter to get better results.

Example Usage

require 'html/pipeline'
require 'html/pipeline/asciidoc_filter'

filters = [
  HTML::Pipeline::AsciiDocFilter,
  HTML::Pipeline::SanitizationFilter,
  HTML::Pipeline::ImageMaxWidthFilter,
  HTML::Pipeline::EmojiFilter,
  HTML::Pipeline::MentionFilter,
  HTML::Pipeline::AutolinkFilter,
  HTML::Pipeline::TableOfContentsFilter,
  HTML::Pipeline::SyntaxHighlightFilter
]

context = {
  :asset_root => 'https://github.global.ssl.fastly.net/images/icons/emoji'
}

pipeline = HTML::Pipeline.new filters, context
pipeline.setup_instrumentation

input = <<-EOS
= Sample Document
Author Name

Preamble paragraph.

== Sample Section

Section content.

.GitHub usernames
- @jch
- @rtomayko
- @mojavelinux

[source,ruby]
--
require 'asciidoctor'

puts Asciidoctor.render('This filter brought to you by http://asciidoctor.org[Asciidoctor].')
--

:shipit:
EOS

puts pipeline.call(input)[:output]

Note about dependencies

You’ll need the following two dependencies which aren’t declared by html-pipeline or this filter.

gem 'activesupport', '>= 2'
gem 'github-linguist', '~> 1.2.6'

TODO

  • remove <p> from text-only list items by defining custom block_paragraph template

  • preserve ToC (likely through subsequent filter)

  • retain checklist items in list (perhaps using text-based checkmarks)

  • enable font-based icons

Copyright © 2013 Dan Allen Free use of this software is granted under the terms of the MIT License.

See the {license}[LICENSE] file for details.

html-pipeline-asciidoc_filter's People

Contributors

mojavelinux avatar

Watchers

 avatar  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.