Git Product home page Git Product logo

Comments (4)

ashb avatar ashb commented on July 19, 2024

This is what the MD JsonML to HTML converter will output as well.

Link references are commonly put at the end of a document or section, so the parser needs to create ref-links as it goes along, and when converting at the end if no reference is found it is output as a literal [bar]:

foo [bar]

[bar]: http://www.google.com

Compare outputs here: http://babelmark.bobtfish.net/?markdown=foo+[bar]%0D%0A%0D%0A[bar]%3A+http%3A%2F%2Fwww.google.com

This comes down to the wonderful fact that markdown doesn't have a formal specification.

from markdown-js.

mishoo avatar mishoo commented on July 19, 2024

I agree it should be linked if there's a [bar]: link-definition somewhere, but it should be left alone otherwise. Most converters in the page you pointed out seem to agree on this.

Perhaps the smarter move would be to scan for link definitions first, and add link_ref only for defined links. I suppose it's not easily doable though.. :-(

from markdown-js.

evilstreak avatar evilstreak commented on July 19, 2024

The HTML output for foo [bar] baz is <p>foo [bar] baz</p>.

We use two intermediary formats to make customisation and extension easier: Markdown -> JsonML (Markdown) -> JsonML (HTML) -> HTML. The link_ref is converted into plain text on the second step, when it becomes JsonML (HTML). Doing it in the first step would be a pain, and could hurt extensibility around link definitions.

from markdown-js.

mishoo avatar mishoo commented on July 19, 2024

The HTML output for foo [bar] baz is

foo [bar] baz

.

Yep, got that, but it's the tree form what I care about here. I'm using markdown-js to parse some API documentation and the JsonML format is pretty good for working with it.

Well, nevermind, I'll just fix up the tree on my own in this case...

from markdown-js.

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.