class HTML::Pipeline

Overview

HTML processing filters and utilities for Crystal.

Defined in:

html-pipeline.cr
html-pipeline/autolink_filter.cr
html-pipeline/filter.cr
html-pipeline/markdown_filter.cr
html-pipeline/plain_text_input_filter.cr
html-pipeline/text_filter.cr
html-pipeline/version.cr

Constant Summary

VERSION = "0.1.0"

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(filters : Array(Filter.class), default_context : Hash(String, String) = {"" => ""}) #

Initialize HTML::Pipeline to give Filter list.

filters = [
  HTML::Pipeline::PlainTextInputFilter,
  HTML::Pipeline::MarkdownFilter,
  HTML::Pipeline::AutolinkFilter,
] of HTML::Pipeline::Filter
pipeline = HTML::Pipeline.new(filters)

[View source]

Class Method Detail

def self.parse(document_or_html : XML::Node | String) #

Parse String or XML::Node instance return XML::Node instance


[View source]

Instance Method Detail

def call(html, context = {"" => ""}) #

Run #call method of all filters


[View source]
def default_payload(payload : Hash) #

[View source]
def filters : Array(HTML::Pipeline::Filter.class) #

[View source]
def perform_filter(filter, doc, context) #

[View source]
def to_html(input, context = {"" => ""}) : String #

Convert raw content to HTML by using all filters Returns HTML

For example:

pipeline = HTML::Pipeline.new(filters)
pipeline.to_html("raw content")

[View source]