Skip to main content

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

  1. Markdown files: Converts references to Markdown files that include anchors.

    [configuration options](autotest.md#configuration-options)
    
  2. reST files: Fixes explicit links to Markdown files.

    `Google Cloud Engine <gce.md>`__
    
  3. Markdown files: Fixes references to reST files.

    [Application examples](examples/readme.rst)
    
  4. 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 useGitHubURL is set to True, it will try to create links based on your githubBaseURL and 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 of baseBranch.

    If useGitHubURL is 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

  1. Install the sphinx_md extension:

    pip3 install sphinx_md
    
  2. Add sphinx_md to the extensions in your conf.py:

    extensions = ['sphinx_md', ...]
    
  3. 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
    

Metadata

Release files for sphinx-md 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinx-md 0.0.4
File Size Uploaded
sphinx-md-0.0.4.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinx-md 0.0.4
File Interpreter ABI Platform
sphinx_md-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 14.5 kB

Release files / sphinx-md-0.0.4.tar.gz

Download URL sphinx-md-0.0.4.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7f84ee6297263cd421e8df2217b20ecba1590f02307901050b34d3eddbb96373
BLAKE2b-256 checksum
How to use checksums
a0c4d394a0fc7a9b5ff9bb342ff157e87830b5df79e240b9a18a6ea33f8b0b97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / sphinx_md-0.0.4-py3-none-any.whl

Download URL sphinx_md-0.0.4-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91b9f55423c9e925fdcb04d1f13c2f1d9f16cfb79e530640dce4a694d8e9fafa
BLAKE2b-256 checksum
How to use checksums
16989a6d60605f597b60b3ce12b641076eab55cf046d7cd2ca24f4c22a33db80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page