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

Add support for the Github markdown API #205

Merged
merged 2 commits into from Feb 19, 2018

Conversation

Projects
None yet
4 participants
@jjatria
Contributor

jjatria commented Feb 16, 2018

This adds a new Pithub::Markdown object with a single method, render, which makes it possible to turn markdown text into HTML. The Pithub::Markdown object can have a default mode and context set, so that project-specific references (like this one: #198) are converted correctly.

This also adds a shortcut to Pithub::Repos which automatically sets the mode to gfm and the context to that of the repository itself, which just makes sense.

This implements the changes discussed in #198.

jjatria added some commits Feb 13, 2018

Shortcut to markdown object from repos
The markdown method in Pithub::Repos creates a Pithub::Markdown
which, in addition to inheriting the parent's user and repo attributes,
sets its default context to the current repo, and the default mode
to Github Flavoured Markdown.

This makes it possible to do

    $repo->markdown->render(
        data => {
            text => 'The answer is in #42'
        },
    );

and have it behave as expected.
@coveralls

This comment has been minimized.

coveralls commented Feb 16, 2018

Coverage Status

Coverage increased (+0.008%) to 99.007% when pulling e531c76 on jjatria:feat-markdown into 877aafd on plu:master.

@plu

plu approved these changes Feb 19, 2018

@plu

This comment has been minimized.

Owner

plu commented Feb 19, 2018

Looks great, thank you!

@plu plu merged commit d6e72f3 into plu:master Feb 19, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jjatria jjatria deleted the jjatria:feat-markdown branch Feb 19, 2018

@oalders

This comment has been minimized.

Collaborator

oalders commented Feb 20, 2018

@jjatria I'm seeing this:

not ok 7 - Pod coverage on Pithub::Markdown                                                                                             │+             (GH#201) (JosJoaqu Atria)
#   Failed test 'Pod coverage on Pithub::Markdown'                                                                                      │+           - Add a rate_limit method to base (GH#204) (JosJoaqu Atria)
#   at /Users/olaf/.plenv/versions/5.26.1/lib/perl5/site_perl/5.26.1/Test/Pod/Coverage.pm line 133.                                     │+           - CPANTS fixes (PRC) (GH#200) (JosJoaqu Atria)
# Coverage for Pithub::Markdown is 33.3%, with 2 naked subroutines:                                                                     │
#       context                                                                                                                         │  0.01033   2016-01-22 17:54:52-05:00 America/Toronto
#       mode

If you have a moment to fix this, I can release a new version with all of your changes. This is in a test which dzil runs but Travis is not currently running.

dzil test all will trigger the error.

@jjatria jjatria restored the jjatria:feat-markdown branch Feb 20, 2018

@jjatria jjatria deleted the jjatria:feat-markdown branch Feb 20, 2018

@jjatria

This comment has been minimized.

Contributor

jjatria commented Feb 20, 2018

@oalders Thanks for the heads-up. I've just created #207 which should fix this. Let me know if it needs anything else.

And thanks for being so responsive! :D

@oalders

This comment has been minimized.

Collaborator

oalders commented Feb 21, 2018

Thanks for all of your work on this, @jjatria. There's a new release on CPAN now. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment