-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better link syntax for cross-references #548
Comments
Conversely, I would suggest for you to write some cross-reference heavy text to understand how difficult the current syntax is to use.
The syntax itself feels just copied from RST. Obviously the semantics need to be there, but it could have been anything that had those three parts. Why, for instance, does MyST use backticks for this? RST uses backticks because in RST backticks are what are used to denote cross-references. In Markdown, backticks mean code. And the Reusing the triple backticks at least makes some sense because that's the only kind of "block" syntax in Markdown (although even that is somewhat annoying because my editor thinks every directive is a code block).
How can you "disagree" that something is hard to remember? I'm telling you that I've had a hard time remembering it (and every time I've looked it up I've had a hard time even finding it because the docs use terminology that I don't expect). You not believing me is not very productive. It seems like every time I interact with you I have to deal with this same sort of thing, and frankly, it's getting tiring.
The colons were just a suggestion to try to prompt discussion. I guessed that they probably wouldn't work for some reason. They point was to give an idea of the sort of thing that might be simpler.
Isn't allowing cross-reference inside of the parentheses already sort of a special case? Anyway, I can tell you that the first thing I ever tried when I wanted to make a custom link was the
I haven't seen these before. Wouldn't a header attribute like described in the first link be preferable to the
You're misunderstanding the point of this. I don't think MyST should know about Alternately Sphinx or docutils itself could be fixed in this regard. I don't really care how it gets fixed, but this is an annoying pain point. |
Hey all - thanks both for sharing your thoughts and perspectives here. I agree with both of you about the pain-points (both on the syntax side, and on the implementation side). I think it's important that we hear each other out about our perspectives and focus on constructive conversation and debate. In my opinion, it is useful to have design-level conversations (e.g. what would be the best user experience?) separately from implementation-level conversations (e.g., what is realistic given our limited development and maintenance resources). I think we should then consider both of them in coming up with a proposed path forward, but the pros/cons of one do not invalidate the other, they should simply be considered together. So, thanks @asmeurer for being open about your pain points here from a user's perspective, and to @chrisjsewell for providing an implementation-level dose of realism here :-) . Context on why this is hard to implement in Sphinx Quick context from what @chrisjsewell was saying. I believe the challenge with the So in Sphinx it's not really a part of the "parsing stage", the MyST spec repo for discussion? This also feels relevant to a few other conversations we've had over the months about how to extend the "role syntax" to include things like options: And I think more generally, something like this would be a good topic for discussion / conversation in the myst-spec repository, where we are trying to define the specification more formally: https://github.com/executablebooks/myst-spec |
Just to be clear here, do you want me to open an issue for this on the myst-spec repo? You can also move this issue to that repo if you feel it would be better to live there. |
Leaving to @choldgraf the decision whether to move this issue over to the spec repo (probably a good idea IMO), I'll comment here... Thx @asmeurer for this writeup! I have just begun to use these aspects more, and your perspective here is very valuable. I think it's worth really looking at the user experience aside from the sphinx/docutils-imposed constraints: ultimately that is an internal implementation layer that could in the long run change. The reason so many of us moved from ReST to md was precisely user experience, and that was the entire reason why we had the original impetus for MyST way back when. We should continue looking for that fluid, joyful experience while writing and sharing content. |
For what it's worth, I've always felt that the most intuitive Markdown link syntax extension for MyST would work as follows:
The look-up for reference targets would essentially do what Python does when it looks up the name of an identifier:
The I know this would break a lot of stuff that's already working somewhat differently in MyST. But I feel(!?) this should be easy on the implementation side, once refactored, and line up better with what users would expect a "multi-document Markdown renderer" to do. |
Just as a note, I have opened up an issue here which is aiming to track various places where there are suggestions/problems/improvements around cross references (including this issue). Another potential avenue that has been discussed is to adopt pandoc citation/reference syntax (starting with an |
|
Just to note @john-hen this is not particularly easy, because any standard CommonMark parser will only recognise these as links, if it can match it to a target, i.e. this would break CommonMark compliance. |
@chrisjsewell Yeah, okay. But it seems that, between you and John MacFarlane, you both agree that that particular example from the CommonMark spec isn't all that useful. And I would add that it's certainly esoteric. I don't think a lot of people are writing things like |
@john-hen I'm afraid that if you don't agree with commonmark specification, then you need to petition for that to change, it is not the business of MyST to go against that. MyST uses a commonmark compliant parser, so it would not be trivial to implement something that went against that anyhow |
Describe the problem/need and solution
I've been using MyST for a bit and it's quite nice being able to use Markdown instead of RST. However, a major pain point is using the cross-referencing syntax. The
{ref}`target`
and{ref}`name <target>`
feel like I am just using a slightly modified version of RST. They aren't very Markdownic, if that is a word. For me, they fail the basic smell tests of good Markdown syntax:Basically, it feels like RST syntax that has been shoved into Markdown rather than the way Markdown would actually implement such a thing.
MyST does let you write
[name](target)
and even[](target)
, and these are both great. But this only works when the target can be accessed withany
. This unfortunately virtually never works for my use-case (cross-referencing functions with autodoc in the SymPy documentation).I would propose extending the usual Markdown link syntax so that you can add the target type before the target name somehow. My suggestion would be to use a colon, like
[name](func:target)
, but if can't work for whatever reason there could be other options. Another suggestion, which is less syntactically nice but would at least make sense logically, would be to allow{ref}`target`
inside of a Markdown link, like[name]({ref}`target`)
(IMO this should be done regardless of whether any other new syntax is added).I would also suggest implementing this in a way so that the
~.
style works so that something like[name](func:~.target)
works (see #468), i.e., get the target for:func:`target`
and then convert that into a link rather than just rewriting it to:func:`name <target>`
.Guide for implementation
No response
Tasks and updates
No response
The text was updated successfully, but these errors were encountered: