Replies: 0 comments 10 replies
-
I’ll add an argument in favor of keeping them: not having to worry about the URL structure of the links, which is nice since the URL structure is often divorced from the directory structure. I used these a lot when doing the Temporal documentation, and having the system auto-link things was very nice. It made find-and-replace of terms with |
Beta Was this translation helpful? Give feedback.
-
I think there are different cases here: the xref macros that link to outside pages are doing very few things:
For |
Beta Was this translation helpful? Give feedback.
-
Over in mdn/content#13802 , @queengooborg replaced all usages of the
{{anch}}
macro with Markdown links.I'd like to propose that we do the same with our xref macros - that is, replace them with plain Markdown links.
What are xref macros?
These are a class of KumaScript macro that create a link, usually within MDN, like
{{domxref}}
or{{cssxref}}
or{{jsxref}}
, but sometimes outside MDN, like{{interwiki}}
or{{rfc}}
. When we did a census of KumaScript macros a few years ago (https://docs.google.com/document/d/1G5KwoJNi8mLmbzcWo-eawH0xw4spVvHGY4Wc4ZEuMYg/edit) we counted 50 of them, making them the second-largest category of macro. They are probably the largest now, since the old largest category of "Internal" has been reduced in the meantime.Arguments against keeping them
All other things being equal it's always better to use normal Markdown for things rather than macros.
{{domxref}}
takes a fourth argument that will suppress code formatting, while{{cssxref}}
AFAIK does not let you suppress code formatting.Arguments in favour of keeping them
They automatically add code formatting. This is a genuine benefit most of the time, although we don't always want code formatting: we often see things like
{{domxref("Fetch_API")}}
which incorrectly code-formats the text. Here the writer needs to do{{domxref("Fetch_API", "Fetch API", "", "something")}}
which isn't at all obvious.They're quicker to write and easier to read. This is sometimes true.
{{domxref("Request")}}
looks great. But in many cases it breaks down, especially with docsets that don't have such a simple organization. For example,{{jsxref}}
works pretty well for global objects, but:for...of
you have to do{{jsxref("Statements/for...of", "for...of")}}
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await
you have to do{{jsxref("Operators/await", "await")}}
Intl.NumberFormat.format()
you have to do{{jsxref("Intl/NumberFormat/format", "Intl.NumberFormat.format()")}}
. This is very non-obvious!Beta Was this translation helpful? Give feedback.
All reactions