hologram icon indicating copy to clipboard operation
hologram copied to clipboard

Make customizing h1, h2, etc output easier

Open jdcantrell opened this issue 10 years ago • 4 comments

Currently we don't allow an easy way to control how headers for different sections are rendered. We don't actually use markdown so the headers can't be controlled in a custom renderer.

See for an example here https://github.com/trulia/hologram/issues/132 for how you have to extend hologram itself to change header tags.

jdcantrell avatar Jul 02 '14 05:07 jdcantrell

Just adding in that it'd be nice to be able to customize the p output as well.

allypalanzi avatar Jul 02 '14 12:07 allypalanzi

We should support paragraphs already like this:

class CustomMarkdownRenderer < HologramMarkdownRenderer
  def paragraph(text)
   return "<p>#{text}</p>"
  end
end

You can see all the different things you can control the output for in the custom renderer at: https://github.com/vmg/redcarpet (search for block-level calls and span-level calls)

Header is special because of how we create the header when generating the markdown. This ticket is to make that case work.

jdcantrell avatar Jul 02 '14 17:07 jdcantrell

Thank you!

allypalanzi avatar Jul 02 '14 18:07 allypalanzi

Hi there, I'm currently trying to do this and it's driving me crazy. I don't understand Ruby, and I can't get @allypalanzi's solution on #132 working. I see that it tries to overload this def(https://github.com/trulia/hologram/blob/master/lib/hologram/document_block.rb#L55) but it doesn't seem to work for me.

I wonder if custom_markdown in the config file is used at all, it does absolutely nothing…

It would be great to have a working example on the sample Hologram style guide, since it's very hard to accomplish with simple HTML knowledge.

Thanks a lot for this amazing project :)

ffoodd avatar Mar 23 '16 13:03 ffoodd