Skip to content

[FEATURE] Link the reStructuredText source from the HTML head - #1401

Closed
linawolf wants to merge 1 commit into
mainfrom
task/rst-source-alternate-link
Closed

[FEATURE] Link the reStructuredText source from the HTML head#1401
linawolf wants to merge 1 commit into
mainfrom
task/rst-source-alternate-link

Conversation

@linawolf

Copy link
Copy Markdown
Member

[FEATURE] Link the reStructuredText source from the HTML head

Tools that read our documentation programmatically - AI assistants above
all - want the content without the surrounding HTML. Until every page is
rendered to Markdown as well, the reStructuredText source we already copy
into _sources/ is the only machine-friendly form we offer, and nothing
in the page points at it: it is reachable only through the "View source"
entry in the options menu.

Emit it as an alternate representation in the <head>:

<link href="_sources/index.rst.txt" rel="alternate"
      title="reStructuredText source" type="text/x-rst">

The link reuses the copy_sources setting and the same copyDownload()
call as the "View source" button, so it appears exactly where the .txt
file is actually written. A single-page render has no single source file,
so sourceFilename() is empty there and no link is emitted.

text/x-rst is the type docutils and PyPI use for reStructuredText;
there is no IANA-registered type for it.

Part of: #1400

Tools that read our documentation programmatically - AI assistants above
all - want the content without the surrounding HTML. Until every page is
rendered to Markdown as well, the reStructuredText source we already copy
into `_sources/` is the only machine-friendly form we offer, and nothing
in the page points at it: it is reachable only through the "View source"
entry in the options menu.

Emit it as an alternate representation in the `<head>`:

    <link href="_sources/index.rst.txt" rel="alternate"
          title="reStructuredText source" type="text/x-rst">

The link reuses the `copy_sources` setting and the same `copyDownload()`
call as the "View source" button, so it appears exactly where the `.txt`
file is actually written. A single-page render has no single source file,
so `sourceFilename()` is empty there and no link is emitted.

`text/x-rst` is the type docutils and PyPI use for reStructuredText;
there is no IANA-registered type for it.

Part of: #1400
@linawolf

Copy link
Copy Markdown
Member Author

We wont do it, the Rest is missing to much information to really recommend it instead we will render to markdown

@linawolf linawolf closed this Sep 12, 2026
@linawolf
linawolf deleted the task/rst-source-alternate-link branch September 12, 2026 08:38
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.

1 participant