executablebooks / rst-to-myst

Convert ReStructuredText to MyST Markdown
https://rst-to-myst.readthedocs.io
MIT License
59 stars 10 forks source link

Conversion to myst loses docinfo #31

Open cpitclaudel opened 3 years ago

cpitclaudel commented 3 years ago

Describe the problem

Sphinx uses docinfo blocks to include information like author name or date. When these are converted from reST to MyST they become front-matter, but these isn't interpreted the same way by the MyST compiler.

For example, this document:

=======
 Title
=======

:author: Me
:date: Today

Becomes this when converted:

---
author: Me
date: Today
---

# Title

But the first one renders as this (with Sphinx):

image

while the second one renders as that:

image

This could be a bug in the MyST compiler, too.

Link to your repository or website

No response

Steps to reproduce

sphinx-quickstart, then add the contents above to a new file.

The version of Python you're using

3.8

Your operating system

GNU/Linux (Mint)

Versions of your packages

$ rst2myst --version
rst2myst, version 0.3.2
$ python3 --version
Python 3.8.10
$ sphinx-build --version
sphinx-build 3.5.4
$ pip show myst_parser | grep Version
Version: 0.15.1

Additional context

No response

welcome[bot] commented 3 years ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

chrisjsewell commented 2 years ago

Yeh this is a tricky one. MyST does not currently support field-lists, outside of front-matter, and so you would need to e.g. "tell" myst that you want these fields shown after the first title, which is a bit ad-hoc.

We have already spoken about implementing field lists in some form, for example for use in Markdown style Python docstrings, and it would be perfectly possible to implement this with a Markdown plugin: https://mdit-py-plugins.readthedocs.io

chrisjsewell commented 2 years ago

Note, with https://github.com/executablebooks/MyST-Parser/pull/455, a more "direct" mapping should now be possible 😄