gjtorikian/html-pipeline

Github Flavoured Markdown table support

Closed this issue · 2 comments

Sorry if I am missing something obvious here but I have tried implementing the GFM syntax for tables into one of my projects.

I have set gfm => true in my application helper and am able to successfully render code blocks, emojis, links and other functionality.

  def markdownify(content)
    pipeline_context = {gfm: true, asset_root: "https://a248.e.akamai.net/assets.github.com/images/icons/"}
    pipeline = HTML::Pipeline.new [
        HTML::Pipeline::MarkdownFilter,
        HTML::Pipeline::EmojiFilter,
        HTML::Pipeline::SanitizationFilter
        ], pipeline_context
        pipeline.call(content)[:output].to_s.html_safe
  end

Is there something else I need to have this functionality?

Try to add :commonmarker_extensions => [ :table].

Yes, we ought to do a better job documenting here, but @amitpatra is correct (based on https://github.com/jch/html-pipeline/blob/010a6bdeace506725d619b95812eb6c4c55ca4c0/lib/html/pipeline/markdown_filter.rb#L11) and you can pass any of the Commonmarker extensions through.