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

support p and pp for CommonMarker::Node #44

Merged
merged 1 commit into from
Apr 22, 2017
Merged

Conversation

gfx
Copy link
Contributor

@gfx gfx commented Apr 19, 2017

Supporting pretty-printing / inspecting is inevitable for debugging.

Resolve #42

example

bundle exec ruby -Ilib -rcommonmarker -e 'pp CommonMarker.render_doc("Hi *there*, I am mostly text!")'

Shows:

#<CommonMarker::Node(document):
  sourcepos={:start_line=>1, :start_column=>1, :end_line=>1, :end_column=>29}
  children=[#<CommonMarker::Node(paragraph):
       sourcepos={:start_line=>1,
        :start_column=>1,
        :end_line=>1,
        :end_column=>29}
       children=[#<CommonMarker::Node(text):
            sourcepos={:start_line=>0,
             :start_column=>0,
             :end_line=>0,
             :end_column=>0},
            string_content="Hi ">,
          #<CommonMarker::Node(emph):
            sourcepos={:start_line=>0,
             :start_column=>0,
             :end_line=>0,
             :end_column=>0}
            children=[#<CommonMarker::Node(text):
                 sourcepos={:start_line=>0,
                  :start_column=>0,
                  :end_line=>0,
                  :end_column=>0},
                 string_content="there">]>,
          #<CommonMarker::Node(text):
            sourcepos={:start_line=>0,
             :start_column=>0,
             :end_line=>0,
             :end_column=>0},
            string_content=", I am mostly text">,
          #<CommonMarker::Node(text):
            sourcepos={:start_line=>0,
             :start_column=>0,
             :end_line=>0,
             :end_column=>0},
            string_content="!">]>]>

@gjtorikian
Copy link
Owner

I think this is awesome. Thank you! Cutting a new version for it now.

@gjtorikian gjtorikian merged commit f44edb4 into gjtorikian:master Apr 22, 2017
@gfx gfx deleted the inspect branch April 24, 2017 01:08
@gfx
Copy link
Contributor Author

gfx commented Apr 24, 2017

Thank you! 🎉

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

Successfully merging this pull request may close these issues.

2 participants