You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm just playing around with mistletoe, and since your fork doesn't allow issues (forks generally don't) I'll put code-specific comments here.
First thing I found: sometimes you want to have colons in arguments. For example in the default sphinx toctree directive it has :caption: Contents:. Doing this with myst results in this error:
yaml.scanner.ScannerError: mapping values are not allowed here
Another piece of syntax that doesn't exist in markdown: comments. Perhaps we want some kind of comment syntax to tell the parser to skip things? Generally people use HTML comments to do this, but I feel like we don't want to encourage that...
First thing I found: sometimes you want to have colons in arguments. For example in the default sphinx toctree directive it has :caption: Contents:.
Ermm yeh it just has to be correct YAML lol, as in caption: "Contents:"
seems that directive nesting is a bit finnicky
You control it by the number of backslashes, each block has to have a different number, with the most on the outside, i.e.
`````{outer}The next info should be nested````{inner}Here's my warning```{more inner}````````````
But obviously the option to indent would be ideal.
However, I don't believe anything like .. _myref: syntax exists in markdown, right?
No it doesn't, I've put a few 'todos' for syntax extensions, primarily targets (i.e. labels), comments (as you say, preferably not just the HTML type ones), and field lists (e.g. so you can use the sphinx :orphan: option).
How would multi-part roles be handled here? E.g. :rst:dir:
Code nesting
Your point about outer-fences being longer than inner seemed to work! That said I am still getting a weird warning about WARNING: Pygments lexer name '' is not known
Firstly, make sure you update your fork, because I did some updates to ensure tests pass, and also added table parsing.
At the bottom of test_docutils_renderer you'll see that I run a test for all of the docutils/sphinx roles/directives (against sphinx_directives.json and sphinx_roles.json). In these tests you can see that I skip a few roles/directives currently that for whatever reason aren't working, must most pass, including multi-part roles.
Code nesting
If you can give me the exact example of what is failing, I can check
Non-kwarg parameters
You would just use non-kwarg: True, but yes potenetially we would add in the docutils field list syntax, which I didn't actually realise was part of the spec. Then maybe use that directly in the directive blocks:
```{name} arguments
:option: a
:non-kwarg:
Content
```
roles link syntax, Why would this work?
Becuse you don't have to have RST/Markdown syntax within the role content. The role function interprets that string however it wants. Just now if it calls a 'nested parse' on all or part of the string, it would be evaluated as Markdown, rather than RST.
In the case of the doc role, you can see how it interprets it here
Another piece of syntax that doesn't exist in markdown: comments. Perhaps we want some kind of comment syntax to tell the parser to skip things? Generally, people use HTML comments to do this, but I feel like we don't want to encourage that...
HTML comments can still be seen in view source though. There seems to be an indirect way of writing comments in markdown specification where it does not appear in the target file, by leveraging the syntax of the link labels. something like:- [//]: <> (This is a comment.) or [//]: # "This is also a comment." . A bit hacky.
Also you can indent nested directives, but the indentation (for each nesting level) has to be less than 4, otherwise it is treated as a standard code block:
a standard code block
e.g.
````{note}
Here's my note
```{warning}
Here's my warning
```
````
We can take a pass through syntax maybe tomorrow or something. This seems reasonable but I guess the main question is whether something like this exists in pandoc already.
Activity
[-]Mistletoe bugs[/-][+]Mistletoe bugs and questions[/+]choldgraf commentedon Feb 12, 2020
Another question - in our example rST file, we have this role:
How would this be accomplished in myst? Something like
?
choldgraf commentedon Feb 12, 2020
seems that directive nesting is a bit finnicky sometimes - the following code doesn't produce proper output for me:
This is also throwing the following warning:
so it sounds like it's treating it as a raw
block
choldgraf commentedon Feb 12, 2020
Labels and other syntax that doesn't exist in rST?
Something else I wanted to do when trying out the roles syntax was using a
refrole. However, normally I use it like so:However, I don't believe anything like
.. _myref:syntax exists in markdown, right?choldgraf commentedon Feb 12, 2020
Another piece of syntax that doesn't exist in markdown: comments. Perhaps we want some kind of comment syntax to tell the parser to skip things? Generally people use HTML comments to do this, but I feel like we don't want to encourage that...
chrisjsewell commentedon Feb 12, 2020
Ermm yeh it just has to be correct YAML lol, as in
caption: "Contents:"You control it by the number of backslashes, each block has to have a different number, with the most on the outside, i.e.
But obviously the option to indent would be ideal.
No it doesn't, I've put a few 'todos' for syntax extensions, primarily targets (i.e. labels), comments (as you say, preferably not just the HTML type ones), and field lists (e.g. so you can use the sphinx
:orphan:option).chrisjsewell commentedon Feb 12, 2020
Just
{doc}`this lecture <heavy_tails>`. I tested and it worked finecholdgraf commentedon Feb 12, 2020
Nice - lemme note a few more points. I'm discovering these as I'm writing up some docs about this spec here:
https://github.com/ExecutableBookProject/markup_test_cases/
Multi-part roles
How would multi-part roles be handled here? E.g.
:rst:dir:Code nesting
Your point about outer-fences being longer than inner seemed to work! That said I am still getting a weird warning about
WARNING: Pygments lexer name '' is not knownNon-kwarg parameters
It's also possible to pass non-kwarg parameters to a directive (e.g. https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive:option-code-block-linenos), which I believe currently doesn't work.
EDIT: Ah I see this is what you mean by field lists above, yeah?
roles link syntax
Why would this work? Isn't that
<>syntax rST and not markdown?Error reporting
I'm noticing that when I get errors, the reporting chain breaks down and I get this error-error:
'LoggingReporter' object has no attribute 'get_source_and_line'Newlines and paragraph breaks
I noticed that breaks in the markup will cause line breaks in the output...maybe this is default markdown behavior?
chrisjsewell commentedon Feb 12, 2020
Firstly, make sure you update your fork, because I did some updates to ensure tests pass, and also added table parsing.
At the bottom of test_docutils_renderer you'll see that I run a test for all of the docutils/sphinx roles/directives (against sphinx_directives.json and sphinx_roles.json). In these tests you can see that I skip a few roles/directives currently that for whatever reason aren't working, must most pass, including multi-part roles.
If you can give me the exact example of what is failing, I can check
You would just use
non-kwarg: True, but yes potenetially we would add in the docutils field list syntax, which I didn't actually realise was part of the spec. Then maybe use that directly in the directive blocks:Becuse you don't have to have RST/Markdown syntax within the role content. The role function interprets that string however it wants. Just now if it calls a 'nested parse' on all or part of the string, it would be evaluated as Markdown, rather than RST.
In the case of the
docrole, you can see how it interprets it hereThat is now fixed, see here
No I don't think it should, I'll look into it
chrisjsewell commentedon Feb 12, 2020
From the commonmark discussions, it looks like comment blocks would be best to start with
%?AakashGfude commentedon Feb 13, 2020
HTML comments can still be seen in
view sourcethough. There seems to be an indirect way of writing comments in markdown specification where it does not appear in the target file, by leveraging the syntax of the link labels. something like:-[//]: <> (This is a comment.)or[//]: # "This is also a comment.". A bit hacky.choldgraf commentedon Feb 13, 2020
@chrisjsewell I think that if there is anything close to consensus elsewhere in markdownland, we should just use that 👍
chrisjsewell commentedon Feb 13, 2020
We can probably move this discussion to
ExecutableBookProject/myst_parsernow.For paragraph breaks, the markdown spec is actually that there are soft breaks (no space after) and hard breaks (2+ spaces or
\):I recall @jstac saying about this before.
Before I was treating these equally:
I've now improved that with:
chrisjsewell commentedon Feb 13, 2020
Also you can indent nested directives, but the indentation (for each nesting level) has to be less than 4, otherwise it is treated as a standard code block:
e.g.
choldgraf commentedon Feb 13, 2020
@chrisjsewell I agree - really fantastic work on spot-checking these.
I will go through any outstanding points here and open a new issue in the new repo, and will then close this issue
chrisjsewell commentedon Feb 13, 2020
LineCommentblock token now added, so this:goes to this:
and is omitted from HTML
chrisjsewell commentedon Feb 13, 2020
Targettoken now added, so you can do things like this:Open to syntax suggestions, but I though the
=was intuitive in showing it is being assigned to the next elementcholdgraf commentedon Feb 13, 2020
Nice - I just added it in the docs to #7
We can take a pass through syntax maybe tomorrow or something. This seems reasonable but I guess the main question is whether something like this exists in pandoc already.
chrisjsewell commentedon Feb 13, 2020
Yeh sure ting, to my knowledge there's no 'target' like syntax/functionality in Commonmark/pandoc, it is a purely RST construct