class HTML::Pipeline
- HTML::Pipeline
- Reference
- Object
Overview
HTML processing filters and utilities for Crystal.
Defined in:
html-pipeline.crhtml-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
-
.new(filters : Array(Filter.class), default_context : Hash(String, String) = {"" => ""})
Initialize HTML::Pipeline to give Filter list.
Class Method Summary
-
.parse(document_or_html : XML::Node | String)
Parse String or XML::Node instance return XML::Node instance
Instance Method Summary
-
#call(html, context = {"" => ""})
Run
#call
method of all filters - #default_payload(payload : Hash)
- #filters : Array(HTML::Pipeline::Filter.class)
- #perform_filter(filter, doc, context)
-
#to_html(input, context = {"" => ""}) : String
Convert raw content to HTML by using all filters Returns HTML
Constructor Detail
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)
Class Method Detail
def self.parse(document_or_html : XML::Node | String)
#
Parse String or XML::Node instance return XML::Node instance
Instance Method Detail
Convert raw content to HTML by using all filters Returns HTML
For example:
pipeline = HTML::Pipeline.new(filters)
pipeline.to_html("raw content")