Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about github markdown filter (low priority!) #165

Closed
patrickdavey opened this issue Dec 8, 2014 · 5 comments
Closed

Question about github markdown filter (low priority!) #165

patrickdavey opened this issue Dec 8, 2014 · 5 comments

Comments

@patrickdavey
Copy link

Hi there,

I have been trying to work out how to stop newline's being inserted into a (github flavour) markdown blockquote.

If I have a markdown file like this:

> this is a start of a quote
> this is a continuation of a quote

according to the docs, github markdown does not put a <br> tag in there.

I have been using your excellent pipeline in a small gem I created for using markdown with the excellent vimwiki plugin, and I keep getting <br> tags inside my generated html. I'm happy to create a test case if it'll help, but I'm wondering if you can tell me what (if any) other filters I should be using. Currently it just uses your sample ones:

pipeline = HTML::Pipeline.new [
  HTML::Pipeline::MarkdownFilter,
  HTML::Pipeline::SyntaxHighlightFilter
]

Any help most appreciated!

@patrickdavey
Copy link
Author

p.s. my gem is quite rough-and-ready... but I did write a failing spec for the quoting issue... patrickdavey/vimwiki_markdown@3299639

@jch
Copy link
Contributor

jch commented Dec 8, 2014

@patrickdavey hmmm, I don't know off the top of my head, but what is the output if you ran it directly through the github-markdown gem? I noticed your diff also bumped the gem to a specific version of github-markdown; Does the problem only appear for specific versions?

@patrickdavey
Copy link
Author

Hi @jch , I wrote a quick spec file and pushed it up to a repo - spec itself is here:
https://github.com/patrickdavey/githubmarkuptest/blob/master/basic_spec.rb

But to summarise, The only way I could find which correctly gave me a blockquote without a <br> in the middle was:

GitHub::Markup.render('README.markdown', markdown_string)

So.. I guess the pipeline using the HTML::Pipeline::MarkdownFilter is using GitHub::Markdown ultimately which is why I'm seeing the difference.

I guess this means I'd need to use Github::Markup to generate the html from the markdown first, and then pass that into the HTML::Pipeline, which is what they say they're doing over here: https://github.com/github/markup in the README.

Assuming that's correct, please just close this issue. I guess the other thing would be to create a HTML::Pipeline::GithubFlavouredMarkupFilter or similar? If that sounds like something which is useful let me know (and I'll try to make time!)

Thanks for the help, your gem is invaluable! 👍

Best,
Patrick

@patrickdavey
Copy link
Author

Yip, changing the call to

    github_markup = GitHub::Markup.render('README.markdown', markdown_body)
    pipeline = HTML::Pipeline.new [
      HTML::Pipeline::SyntaxHighlightFilter
    ]   
    result = pipeline.call(github_markup)
    result[:output].to_s

works fine. Assuming that's the way I should always have been using it (quite probably I misunderstood something) please just close this issue.

@jch
Copy link
Contributor

jch commented Dec 12, 2014

@patrickdavey nice detective work!

I guess the other thing would be to create a HTML::Pipeline::GithubFlavouredMarkupFilter or similar?

If you're looking for GitHub flavored markdown, you can pass :gfm => true as an option to the filter:

filter = HTML::Pipeline::MarkdownFilter.new("Hi **world**!", :gfm => true)
filter.call

Closing now because you've fixed your issue, but feel free to comment further.

@jch jch closed this as completed Dec 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants