Sphinx extension to use with Recommonmark or MystParser to fix links to rst from md, links to md from rst, and links to embedded files and dirs.
Project description
Sphinx Markdown Extension
This extension fixes or improves how Sphinx handles links related to Markdown
when it generates the HTML site. It assumes you are using the recommonmark
extension. It's a good idea to use sphinx_markdown_tables as well.
Contents
What it does
-
Markdown files: Converts references to Markdown files that include anchors.
[configuration options](autotest.md#configuration-options)
-
reST files: Fixes explicit links to Markdown files.
`Google Cloud Engine <gce.md>`__
-
Markdown files: Fixes references to reST files.
[Application examples](examples/readme.rst)
-
Markdown files: Fixes links to files and directories within the GitHub repo.
[Makefile](/Makefile) [deploy/kustomize](/deploy/kustomize)
Links to files can be fixed one of two ways, which can be set in the conf.py.
baseBranch = "devel" useGitHubURL = True commitSHA = getenv('GITHUB_SHA') githubBaseURL = "https://github.com/intelkevinputnam/pmem-csi/"
If
useGitHubURLis set to True, it will try to create links based on yourgithubBaseURLand the SHA for the commit to the GitHub repo determined by the GitHub workflow on merge). If there is no SHA available, it will use the value ofbaseBranch.If
useGitHubURLis set to False, it will copy the files to the HTML output directory and provide links to that location.NOTE: Links to files and directories should use absolute paths relative to the repo (see Makefile and deploy/kustomize above). This will work both for the Sphinx build and when viewing in the GitHub repo.
Links to directories are always converted to links to the GitHub repository.
How to use it
-
Install the sphinx_md extension:
pip3 install sphinx_md
-
Add
sphinx_mdto the extensions in yourconf.py:extensions = ['sphinx_md', ...]
-
If you want to use GitHub commit links, add the entire code snippet to your
conf.py:from os import getenv sphinx_md_useGitHubURL = True baseBranch = "devel" commitSHA = getenv('GITHUB_SHA') githubBaseURL = 'https://github.com/' + (getenv('GITHUB_REPOSITORY') or '<your_group/your_project>') + '/' githubFileURL = githubBaseURL + "blob/" githubDirURL = githubBaseURL + "tree/" if commitSHA: githubFileURL = githubFileURL + commitSHA + "/" githubDirURL = githubDirURL + commitSHA + "/" else: githubFileURL = githubFileURL + baseBranch + "/" githubDirURL = githubDirURL + baseBranch + "/" sphinx_md_githubFileURL = githubFileURL sphinx_md_githubDirURL = githubDirURL
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sphinx-md-0.0.4.tar.gz.
File metadata
- Download URL: sphinx-md-0.0.4.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f84ee6297263cd421e8df2217b20ecba1590f02307901050b34d3eddbb96373
|
|
| MD5 |
274b99a011464e529dc4742a91d13399
|
|
| BLAKE2b-256 |
a0c4d394a0fc7a9b5ff9bb342ff157e87830b5df79e240b9a18a6ea33f8b0b97
|
File details
Details for the file sphinx_md-0.0.4-py3-none-any.whl.
File metadata
- Download URL: sphinx_md-0.0.4-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91b9f55423c9e925fdcb04d1f13c2f1d9f16cfb79e530640dce4a694d8e9fafa
|
|
| MD5 |
009d679d6e0bcc25c4c3dacf3a34d097
|
|
| BLAKE2b-256 |
16989a6d60605f597b60b3ce12b641076eab55cf046d7cd2ca24f4c22a33db80
|