Giter Site home page Giter Site logo

Comments (2)

jgm avatar jgm commented on June 3, 2024

Some of the options are render options, others are parsing
options. There are no options that are used in both phases.

Parsing: NORMALIZE, VALIDATE_UTF8, SMART

Rendering: SOURCEPOS, SAFE, HARDBREAKS

This could be clearer from the cmark.3 man page, because
currently the options are under a heading "Rendering."
Originally we only had writer options.

I don't want to store render options in the parse tree,
since the same parsed AST might be rendered in different
ways. But maybe it would make sense to more clearly
distinguish between reader and writer options, either in
cmark, or in the ruby wrapper, or both places.

+++ Garen Torikian [Oct 25 15 13:21 ]:

An interesting issue came up on the [1]Ruby wrapper for libcmark.

It looks like, in order to render a string into a document, and that
document into HTML, you must pass the rendering options twice, like
this:

doc = CommonMarker.render_doc(markdown, [:smart, :hardbreaks])
assert_equal result, doc.to_html([:smart, :hardbreaks])

As far as I can see, there's no way for render_doc to store the render
options on the cmark_node document itself. And there's no way for that
same node to call to_htmlβ€”it must be handled by a different
cmark_render_html method.

Is that correct? And if so, is that design intentional? I could piece
something together for the Ruby wrapper to work around this, but I
thought it might make sense to apply the change at the C level.

β€”
Reply to this email directly or [2]view it on GitHub.

References

  1. gjtorikian/commonmarker#18
  2. #88

from cmark.

gjtorikian avatar gjtorikian commented on June 3, 2024

That makes sense. I'll change the title to reflect that this might be better fixed by a change in the docs.

from cmark.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.