MyST-Parser: Add suppress warning type for any `'myst' reference target not found`

The following warning:

../../CONTRIBUTING.md:4: WARNING: 'myst' reference target not found: README.md

doesn’t seem to be raised in the same was as other myst warnings, eg doesn’t have [myst.header] at the end of the warning.

To Reproduce

Steps to reproduce the behavior:

  1. Create markdown document with a reference to root level readme eg [README](README.md)
  2. Add suppress_warnings = ['myst.reference'] to sphinx conf.py
  3. Build docs with sphinx

Expected behavior

Would be nice to suppress any warning by any arbitrary text.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 3
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@mara004 what worked for me is:

suppress_warnings = [ 'ref.myst']

I guess that the need of the original author is to suppress these warnings, not to fix the issue itself. I have the same request.

I include some files in the Sphinx documentation which are targeted at people who navigate the source code in an IDE or in a github or Bitbucket GUI. I include links to certain files which should not be copied to the documentation output, e.g. a header file or source file, to support easy navigation in the code.

The warnings we get are along the lines of:

/home/user/workspace/package/README.md:13: WARNING: 'myst' reference target not found: ./CMakeLists.txt
/home/user/workspace/package/README.md:13: WARNING: 'myst' reference target not found: ./src/main.cpp
/home/user/workspace/package/README.md:13: WARNING: 'myst' reference target not found: ./test/excluded-document.md

Wanted behavior: Just remove the link and output the text (if available) or the link.

ideally, all files which are excluded or have different file extension (e.g. *.txt, *.cpp, *.h, *.xml) do not raise a warning, while others do.

Which warning type do I need to suppress to hide 'myst' reference target not found and Unknown target name warnings?

Naturally, we are happy to receive PRs with proposals to add such features