Skip to content
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

[Doc] Fix some minor markup errors in manual #20112

Merged

Conversation

quantimnot
Copy link
Contributor

  • Fix header level for noalias pragma section.
  • Fix code snippet outside of code block that raised an error with rst2html.
  • Fix broken 'Convertible relation' links that were raising warnings.

* Fix header level for noalias pragma section.
* Fix code snippet outside of code block that raised an error with `rst2html`.
* Fix broken 'Convertible relation' links that were raising warnings.
@a-mr
Copy link
Contributor

a-mr commented Jul 30, 2022

It's worth noting that all automatic links to subsections (like `convertible relations`_ ) are broken in cases when there is a TOC in a file. But I would not bother fixing them at the moment (this PR is different though because there is that annoying warning). It's a regression since 1.6.x, probably broken by my addition of smart doc links #18642.

We shall to convert them to Markdown style links anyway. Markdown spec allows only links with the explicit target, but fortunately there is the implicit_header_references extension from Pandoc Markdown.

To summarize:

Type relations
==============

Convertible relation
--------------------

Old RST ways of referencing:
- manual `Convertible relation <#type-relations-convertible-relation>`_
- automatic, buggy in devel  `Convertible relation`_ 

New Markdown ways:
- manual [Convertible relation](#type-relations-convertible-relation)
- automatic, not yet supported: [Convertible relation]()

@quantimnot
Copy link
Contributor Author

@a-mr I thought there was some automatic mechanism and I tried removing the explicit anchor in the first link, but it wasn't working. Good to know about the changes. Thank you

@Varriount Varriount merged commit 313ce91 into nim-lang:devel Aug 1, 2022
@quantimnot quantimnot deleted the pr_manual_noalias_header_level branch August 1, 2022 11:37
@a-mr
Copy link
Contributor

a-mr commented Aug 1, 2022

Actually I re-checked links to sub-headers in 1.6 and 1.0 and it did not work.
So it's unrelated with recent changes and very probably never worked.

a-mr added a commit to a-mr/Nim that referenced this pull request Aug 27, 2022
It was observed (in nim-lang#20112)
that links to 2nd- (and subsequent) -level headings
fail if TOC is present, e.g.:
```nim
.. contents::

Type relations
==============

Convertible relation
--------------------

Ref. `Convertible relation`_
```

The problem here is that links are resolved in `rst.nim` but later
`rstgen.nim` fixes ("fixes") anchors to make them unique so that
TOC always works (if e.g. there was another sub-section like
"Convertible relation").
The solution implemented in this PR is to move that fix-up of anchors
into `rst.nim`, so that link resolution could know final anchors.

The bug seems to be added in nim-lang#2332
in 2015, that is it is present in Nim 1.0.
Varriount pushed a commit that referenced this pull request Aug 27, 2022
Fix links to subheader when TOC is present

It was observed (in #20112)
that links to 2nd- (and subsequent) -level headings
fail if TOC is present, e.g.:
```nim
.. contents::

Type relations
==============

Convertible relation
--------------------

Ref. `Convertible relation`_
```

The problem here is that links are resolved in `rst.nim` but later
`rstgen.nim` fixes ("fixes") anchors to make them unique so that
TOC always works (if e.g. there was another sub-section like
"Convertible relation").
The solution implemented in this PR is to move that fix-up of anchors
into `rst.nim`, so that link resolution could know final anchors.

The bug seems to be added in #2332
in 2015, that is it is present in Nim 1.0.
capocasa pushed a commit to capocasa/Nim that referenced this pull request Mar 31, 2023
* Fix header level for noalias pragma section.
* Fix code snippet outside of code block that raised an error with `rst2html`.
* Fix broken 'Convertible relation' links that were raising warnings.

Co-authored-by: quantimnot <[email protected]>
capocasa pushed a commit to capocasa/Nim that referenced this pull request Mar 31, 2023
Fix links to subheader when TOC is present

It was observed (in nim-lang#20112)
that links to 2nd- (and subsequent) -level headings
fail if TOC is present, e.g.:
```nim
.. contents::

Type relations
==============

Convertible relation
--------------------

Ref. `Convertible relation`_
```

The problem here is that links are resolved in `rst.nim` but later
`rstgen.nim` fixes ("fixes") anchors to make them unique so that
TOC always works (if e.g. there was another sub-section like
"Convertible relation").
The solution implemented in this PR is to move that fix-up of anchors
into `rst.nim`, so that link resolution could know final anchors.

The bug seems to be added in nim-lang#2332
in 2015, that is it is present in Nim 1.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants