Created
March 13, 2023 08:32
-
-
Save tk0miya/a7e40ee2c7aac2da3f96d33e0ec463df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# リテラルスタイルのアンカーを作る | |
# | |
# 使い方: :codehref:`blah blah blah <http://path.to/anywhere>` | |
# | |
from docutils import nodes | |
from sphinx.util.docutils import ReferenceRole | |
class CodeHref(ReferenceRole): | |
def run(self): | |
ref = nodes.reference(self.title, self.title, refuri=self.target) | |
return [nodes.literal('', '', ref)], [] | |
def setup(app): | |
app.add_role('codehref', CodeHref()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment