Comments (2)
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:
-
Only offers a html renderer, when we need a markdown renderer.
-
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.
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)
- IPython.html.widgets` has moved to `ipywidgets`.", ShimWarning HOT 2
- error after adding c.NotebookApp.contents_manager_class = 'notedown.NotedownContentsManager' HOT 2
- Conda version not working: line 4, in <module> import notedown.main File "<frozen importlib._bootstrap>", line 971, in _find_and_load
- UnicodeDecodeError on Windows but not WSL
- Code blocks in markdown HOT 1
- pandoc is producing non-ascii characters
- UnicodeEncoderError when converting notebook containing Chinese characters HOT 4
- Integration with Jupyter HOT 4
- Issue with Tables due to Linewrap HOT 1
- Jupyter Lab: use markdown as its storage format HOT 2
- Markdown header is incorrectly broken into multiple lines (and displayed strangely) HOT 2
- 这个插件是不是不能兼容Python2.7啊 HOT 1
- Notedown fork: Knitty HOT 3
- Can't open .MD file correctly.
- notedown ignores comments in markdown
- pip install failed (format missing) HOT 1
- fedora 32 not install
- Error while saving file: foo.md display_priority.j2
- Invalid Syntax
- Used nbconverter template is deprecated now and throws an error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from notedown.