Closed reiyw closed 2 years ago
Thanks for submitting your first pull request! You are awesome! :hugs:
If you haven't done so already, check out EBP's Code of Conduct and our Contributing Guide, as this will greatly help the review process.
Welcome to the EBP community! :tada:
Thanks for this change @reiyw, I hadn't realised this was different in MyST vs rST
Does the nested_parse strip off the blank line from rST?
Yes, I am not aware of the detailed behavior of nested_parse
, but at least when I tested it in my environment it was stripping off the line from the rST.
.. tabs::
.. tab:: test
test
Before this change:
After this change:
Once I've merged #164 we can rerun the tests here to confirm it doesn't break any tested rST behaviour
pre-commit.ci run
Created #165 to merge master
and run tests
This pull request fixes a problem where the first line of content in a
tab
orgroup-tab
directive is stripped in MyST.The following in MyST will render with the first line in the
tab
andgroup-tab
blocks stripped.The cause of this is the index specification when getting the directive content within the
TabDirective.run
method.https://github.com/executablebooks/sphinx-tabs/blob/0b04c8eb37075d57f6d5ad321ca40f4e800894f8/sphinx_tabs/tabs.py#L187
The directive syntax in reStructuredText requires a blank line before the content, so
self.content[1]
is guaranteed to be a blank line. However, MyST has no such restriction; the actual content starts fromself.content[1]
when written as in the example above. Therefore, if one slices it asself.content[2:]
, the first line of the content will be stripped.So, I modified it so that the first line of content is parsed in MyST by slicing the content from
[1:]
. I think that this change does not affect the parsing of content in reStructuredText.