Skip to content
This repository has been archived by the owner on Mar 25, 2022. It is now read-only.

Warnings for relative links to other documents #130

Closed
asmeurer opened this issue Jan 16, 2019 · 12 comments
Closed

Warnings for relative links to other documents #130

asmeurer opened this issue Jan 16, 2019 · 12 comments

Comments

@asmeurer
Copy link

I am getting warnings building my site like:

$ make html
Running Sphinx v1.8.3
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: 7 added, 0 changed, 0 removed
/Users/aaronmeurer/anaconda3/lib/python3.6/site-packages/recommonmark/parser.py:65: UserWarning: Container node skipped: type=document
  warn("Container node skipped: type={0}".format(mdnode.t))
reading sources... [100%] usage
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] usage
/Users/aaronmeurer/Documents/brown-water-python/docs/helper-functions.md:4: WARNING: None:any reference target not found: usage.html
/Users/aaronmeurer/Documents/brown-water-python/docs/helper-functions.md:189: WARNING: None:any reference target not found: alternatives.html
/Users/aaronmeurer/Documents/brown-water-python/docs/helper-functions.md:267: WARNING: None:any reference target not found: intro.html
/Users/aaronmeurer/Documents/brown-water-python/docs/intro.md:142: WARNING: None:any reference target not found: alternatives.html
/Users/aaronmeurer/Documents/brown-water-python/docs/usage.md:150: WARNING: None:any reference target not found: tokens.html
/Users/aaronmeurer/Documents/brown-water-python/docs/usage.md:305: WARNING: None:any reference target not found: examples.html
generating indices... genindex
writing additional pages... search
copying static files... done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded, 6 warnings.

The HTML pages are in _build/html.

The warnings are coming from relative links to other pages, like [link](page.html). The links in the final site seem to work fine.

It used to build fine, so something broke. I don't know if the UserWarning is related.

@tpatnoe
Copy link

tpatnoe commented Mar 12, 2019

I am seeing the same thing. I usually run with sphinx option -W to turn warnings into errors. This is very useful to keep clean documentation.

The relative links which warning and then error are *.md or *.rst files which eventually are converted into *.html.

Perhaps check for *.md or *.rst equivalent for missing HTML files.

@tpatnoe
Copy link

tpatnoe commented Mar 12, 2019

Rolling back to version 0.4.0 of recommonmark still logs a warning but doesn't stop the build.

@asmeurer
Copy link
Author

asmeurer commented Mar 12, 2019

It seems I forgot to mention here, changing the link from [link](page.html) to [link](page.md) makes the warning go away. But then the link in the rendered page doesn't have any Markdown formatting! Markdown formatting in links is one of the reasons I'm using recommonmark in the first place, instead of normal Sphinx with RST.

I also use html: SPHINXOPTS += -W in my Makefile, as warnings in Sphinx tend to be things that you want to fix, but I've had to disable it because of this bug.

CountBacula added a commit to ans-group/docs.ukfast.co.uk that referenced this issue Apr 23, 2019
CountBacula added a commit to ans-group/docs.ukfast.co.uk that referenced this issue Apr 23, 2019
laf pushed a commit to ans-group/docs.ukfast.co.uk that referenced this issue May 1, 2019
* Added page for mailtester and added to index.rst file

* Added title for mailtester page

* Just testing my SSH key.

* Made a start on instructions for use of mailtester

* added first image to mailtester docs

* Made a start to 'results' section

* Added content to mail-tester page

* Fixed a couple of formatting issues (text on same line as some images)

* re-added missing rdns.png

* added meta

* correcting metadata

* changed linked path: ["What factors affect DNS propagation
time?"](/Domains/domains/dnspropagation.html) to (/Domains/domains/dnspropagation.md)

* changed link path /DOmains/ssl/types.html to /types.nd

* added metadata for ttl.md

* changed reference /Domains/safedns/addnewdomain.html to .md

* Update IP addresses in getting started pages for ddosx (#376)

IP Ranges were missing in the nginx and and apache section

* enforce recommonmark version (#383)

Workaround for bug readthedocs/recommonmark#130

* New docs page for Windows Update Install options (#379)

* Added Windows Update Options

Added a page explaining how to change Windows Update installation options

* Edited name of Windows Update page

Changed name from "Changing Windows Updates Schedules" to "Changing Windows Updates Installation Options"

* Fixing Formatting

Fixing formatting on the "Changing Windows Updates Installation Options" page

* Formatting again

Fixing Formatting on "Changing Windows Updates Installation Options"

* Formatting

Formatting on Windows Updates installation options

* Added new folder for Windows tips

Added a new folder for Windows tips, and added a first tip page

* Fixing file link

Fixing image link in TLS Powershell docs page

* Fixing image

Fixing image again

* Changing file name

Changing image name to remove number

* Moved files folder into Powershell

Moved files folder into Powershell

* Changing filepath to image

* Added eval meta info to TLS page

* Added index.rst file

* Changed apostrophes for backticks for proper code highlighting

* Editing backtick spacing

* Removed tips, keeping as just a powershell folder

* Removed reference to old Tips folder from index.rst

* Added reference to TLS in Powershell article to index.rst

* Added eval_rst to Powershell index.rst file 

As per https://github.com/ukfast/docs.ukfast.co.uk

* Typos

* Added powershell/index

* Updated file names to be lowercase for type

* Reverted html -> md changes
asmeurer added a commit to asmeurer/brown-water-python that referenced this issue Aug 23, 2019
We have to do this until
readthedocs/recommonmark#130 is fixed.
@gibfahn
Copy link
Contributor

gibfahn commented Aug 27, 2019

What happens if you do [link](page.html) -> [link](page)?

@asmeurer
Copy link
Author

@gibfahn looks like it's the same as [link](page.md). It removes the warning and the link works, but it removes all the formatting from the link text.

@drrosa
Copy link

drrosa commented Oct 10, 2019

Changing the link from [link](page.html) to [link](page.md) makes the warning go away. But then the link in the rendered page doesn't have any Markdown formatting! Markdown formatting in links is one of the reasons I'm using recommonmark in the first place, instead of normal Sphinx with RST.

I also use html: SPHINXOPTS += -W in my Makefile, as warnings in Sphinx tend to be things that you want to fix, but I've had to disable it because of this bug.

@asmeurer I'm not seeing any rendering problems when I try this, but what exactly do you mean by "it removes all the formatting from the link text"?

Are you saying that something like **[formatting](page.md)** would end up with its bold formatting removed and rendered as "formatting" instead?

@asmeurer
Copy link
Author

Yes, except I use rendering inside the link, like [`code`](page.md). I haven't tried moving it outside the link.

@drrosa
Copy link

drrosa commented Oct 10, 2019

Oh, I see. Yeah, the formatting inside the link text doesn't work unless it's an .html link. Formatting outside of an .md link definitely works though.

Hint: I also noticed that .html links with an #anchor don't trigger those Warnings. So you could add an anchor to links where you want to have code formatting. i.e. [`code`](page.html#dummy-anchor)

@caspar-ai
Copy link

Are there any plans to fix this issue? I am still seeing it on Sphinx==2.3.1 and recommonmark==0.6.0.

Specifically linking to a pre-built HTML document from inside a markdown file produces a warning during the sphinx build. We use it when we reference the output from a doxygen build, although you can reproduce with any local HTML reference.

I have tried all the different suggestions above and none work, specifically:

  • [link](./test.html) <- The one I would expect to work
  • [link](test.html)
  • [link](./test)
  • [link](test)
  • [link](./test.md)

All produce a warning similar to this:

/cdh/test.md:3: WARNING: None:any reference target not found: ./prebuilt.html

@drrosa is correct that adding the #anchor makes the warning go away, but that appears to be because it suppresses all checks, i.e. if not_there.html actually doesn't exist, then the following will not produce an error:

[link](./not_there.html#dummy-anchor)

Which means that enabling warnings becomes once again meaningless to catch broken / stale internal references.

(P.S. I think the last post suggested this wasn't an issue except for losing formatting - I don't have any formatting concerns, just a plain old link is fine - so perhaps two separate issues here?)

@stefanv
Copy link

stefanv commented Jul 15, 2020

We are trying to link to a static .json file from a document, and are seeing the same:

user_guide.md:262: WARNING: None:any reference target not found: data/example.json

stefanv added a commit to stefanv/fritz that referenced this issue Jul 15, 2020
These `.json` files are not currently copied to the output directory.
This seems to be a problem with the way recommonmark handles links with
extensions.

See also readthedocs/recommonmark#130 (comment)
@asmeurer
Copy link
Author

FWIW, I've switched from recommonmark to MyST https://myst-parser.readthedocs.io/en/latest/. It is very similar to recommonmark (Markdown syntax with Sphinx), but unlike recommonmark, it adds some syntax to do cross-references, so that issues like this aren't a problem (you can do real cross-references which are checked by Sphinx).

@balopat
Copy link

balopat commented Sep 3, 2020

Same thing happens with relative paths targeting .ipynb files - interestingly, if I remove the extension, it works 🤔, but that breaks Github's linking. I agree @asmeurer, MyST seems to do a good job with minimal overhead to switch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants