GithubHelp home page GithubHelp logo

lists with paragraphs about notedown HOT 2 OPEN

aaren avatar aaren commented on June 14, 2024
lists with paragraphs

from notedown.

Comments (2)

aaren avatar aaren commented on June 14, 2024

Thanks for reporting again.

This is because notedown isn't very clever about parsing markdown and it is parsing item 1b as an indented code block. It does this regardless of the match setting.

With --match=all, item 1b ends up as a code block.

With --match=fenced, item 1b is converted back into a markdown cell

With any other --match value we get the error above. This happens because None is used in place of the block content. This is to do with the parsing difference between fenced and indented blocks. Previous to the merge of #41 this bit of code was inaccessible to indented blocks.

I've been thinking about switching to a proper parser for a bit but haven't got round to it. I could maybe hack another patch onto the homegrown parser so that it excludes list items from being code blocks.


Note on parsers: I've looked at using mistune before (used by jupyter). Mistune doesn't parse attributed code blocks by default but it is easy enough to make a new grammar rule that does. Mistune then does a great job of parsing all of the markdown correctly and giving back an AST.

Problem with mistune:

  1. Only offers a html renderer, when we need a markdown renderer.

  2. Doesn't output where in the text certain matches occur. With this we could chop out the code blocks like notedown does and avoid needing to know anything about markdown.

Fixing (1) by writing a markdown renderer seems a bit full on. However, it would be a good contribution to mistune. If there was also a way to convert mistunes AST into pandoc's json AST then you could do a lot of powerful things, leveraging pandoc filters.

(2) is more addressable. It would require monkey patching mistune.BlockLexer.parse to return the regex match group, from which line numbers can be determined, as well as tweaking the fenced code grammar rule.

from notedown.

izahn avatar izahn commented on June 14, 2024

OK makes sense, I'll just edited the input documents by hand for now.
notedown saved me hours of tedious work already, thank you!
On Mar 24, 2016 6:59 PM, "aaren" [email protected] wrote:

Thanks for reporting again.

This is because notedown isn't very clever about parsing markdown and it
is parsing item 1b as an indented code block. It does this regardless of
the match setting.

With --match=all, item 1b ends up as a code block.

With --match=fenced, item 1b is converted back into a markdown cell

With any other --match value we get the error above. This happens because
None is used in place of the block content. This is to do with the
parsing difference between fenced and indented blocks. Previous to the
merge of #41 #41 this bit of code
was inaccessible to indented blocks.

I've been thinking about switching to a proper parser for a bit but
haven't got round to it. I could maybe hack another patch onto the
homegrown parser so that it excludes list items from being code blocks.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#43 (comment)

from notedown.

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.