Sphinx "linkattr" extension
Project description
sphinxcontrib-linkattr
A Sphinx extension, which overrides attributes of internal/external links.
Install
pip install sphinxcontrib-linkattr
Usage
Add sphinxcontrib.linkattr
in the extensions
list in conf.py
.
extensions += ['sphinxcontrib.linkattr']
Configuration
-
linkattr_attr_external
: (default:{'target': '_blank', 'rel': 'noreferrer noopener'}
)Attributes for external links. The default value implements open in new tab behavior for
html
builders. -
linkattr_suffix_external
: (default:None
)A string/object which is placed after the link texts of external links. Possible types of the value are
None
: Nothing.str
: String.dict
: This is interpreted as adoctutils.nodes
object, which class is'node'
element and properties are the rest elements (Seetests/fontawesome/conf.py
as an example).
-
linkattr_attr_internal
: (default:{}
)Attributes for internal links (See also
linkattr_attr_external
). -
linkattr_suffix_internal
: (default:None
)A string/object which is placed after the link texts of internal links (See also
linkattr_suffix_external
). -
linkattr_custom_translator_dict
: (default:{}
)A dictonary which has
format
:Translator object
pairs. If you want to use a custom builder class, this may be helpful.
Examples (Build Results)
-
A simple example with an open in new tab function and a suffix
[external link]
. -
An example of the usage of
linkattr_suffix_external
as adoctutils.nodes
object, which has a Font Awesome icon. -
An example of the usage of css with
.external
class andbackground-image
attribute. This is inspired by the method Wikipedia employs.
License
MIT License
Project details
Release history Release notifications | RSS feed
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
Hashes for sphinxcontrib-linkattr-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d6cfc00d65c211c9e5972b356de37ccbfa6688c32130e693104ede14923b8a8 |
|
MD5 | e2cdd3d5d2d58ef6a88fe80d6e169ff4 |
|
BLAKE2b-256 | 7643b92be575dfc85dc3621578aa9bfb19f2757329c48891315836defe4ed073 |
Hashes for sphinxcontrib_linkattr-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4acc633ce5bffc889614b1423be25cecb26dd735b2b76c307ac9ba92f43d1ee1 |
|
MD5 | 34411a1a55f7cccdd7e0da5ed1682037 |
|
BLAKE2b-256 | 79ffdee5c8b51b7d919144802caf358f728043fb1b8f15c29f0370310f60998d |