qrenderer
This is an experimental renderer for quartodoc. It can only be installed from github and it will never be released on PyPi. Some version of it may find its way into quartodoc. Use it with caution, there will be breaking changes.
Install
$ pip install git+https://github.com/has2k1/qrenderer.git
How to extend quartodoc with qrenderer
Import
QRenderer
which is the bridge between this renderer and quartodoc’s current rendering system.Import the decorator
extend_base_class
that make makes it possible to modify the classes that you extend.Import any Render classes that you want to extend. The options are:
RenderDoc
to extend the common parts toclasses
,functions
,attributes
andmodules
.RenderDocClass
to extend rendering ofclasses
.RenderDocFunction
to extend rendering offunctions
.RenderDocAttribute
to extend rendering ofattributes
.RenderDocModule
to extend rendering ofmodules
.RenderDocCallMixin
to extend rendering of the common part parts offunctions
and classmethods
i.e. callables.RenderDocMembersMixin
to extend rendering of the common parts ofmodules
andclasses
i.e. objects with members.RenderLayout
to extend rendering of the Reference page.RenderSection
to extend rendering of a section/group of objecs on Reference page.RenderPage
to extend rendering of page that contains the documentation of one or more objects. i.e. links from the Reference lead to this type of page.
Wheen overriding the defaults, the common methods to extend are:
Though for some types, it does not make sense to extend some of these methods. e.g.
modules
andattributes
do not have signatures so extending therender_signature
method would not have an effect.Download qrenderer.scss into your
doc
directory.
Example
Keeping the original signature of a class, we add a line of text below it.
_renderer.py
from quartodoc.pandoc.blocks import Blocks
from qrenderer import QRenderer, extend_base_class, RenderDocClass
class Renderer(QRenderer):
pass
@extend_base_class
class _RenderDocClass(RenderDocClass):
def render_signature(self):
= super().render_signature()
sig return Blocks([sig, "Line below the class signature"])
Then your minimal configuration file should contain
_quarto.yml
project:
type: website
format:
html:
toc: true
theme:
- lumen # bootswatch theme
- qrenderer.scss # qrenderer's customisation
- custom.scss # your customisation
quartodoc:
package: your_package
renderer:
style: _renderer.py
typing_module_paths:
- your_package.typing # path to your type annotations
The easiest customisation you can make is to change the primary color of your documentation.
custom.scss
/*-- scss:defaults --*/
$primary: #9E2F68;
/*-- scss:mixins --*/
/*-- scss:rules --*/
/*-- scss:functions --*/
/*-- scss:uses --*/