CrossNox / m2r2

Markdown to reStructuredText converter
https://crossnox.github.io/m2r2
MIT License
107 stars 26 forks source link

Generating the right rST for formatting within links #41

Open micahjsmith opened 2 years ago

micahjsmith commented 2 years ago

In markdown, one can do format the text of a link without any problems

[`my.api.method`](http://example.com)

However, from this m2r2 generates

``my.api.method` <http://example.com>`_

This is not valid rST and just renders literally.

We'd like to generate the following HTML:

<a href="http://example.com"><code>my.api.method</code></a>

This isn't really the "fault" of m2r2, as rST doesn't really support this construct. A workaround is here. Perhaps m2r2 could implement this workaround? Seems pretty messy unfortunately.

CrossNox commented 2 years ago

Related to #36 As you said, rST does not allow these kind of constructs.

I'm happy to look at a PR with a small test suite, with a config that allows for having this "fail"/use the workaround.

endolith commented 1 year ago

Same problem for me. My .md has

As of this README, it includes  [`numpy`](https://numpy.org/) and 
[`scipy`](https://www.scipy.org/)for the simulations, 
[`tabulate`](https://github.com/astanin/python-tabulate) for printing 
example tables, [`joblib`](https://joblib.readthedocs.io/en/latest/) for
parallelizing extreme examples, and  [`pytest`](https://docs.pytest.org/en/latest/), …

etc and it mangles all of them:

image

Can it just strip the `` tags when converting to rst if they aren't supported?