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
QRendererwhich is the bridge between this renderer and quartodoc’s current rendering system.Import any Render classes that you want to extend. The options are:
RenderDocto extend the common parts toclasses,functions,attributesandmodules.RenderDocClassto extend rendering ofclasses.RenderDocFunctionto extend rendering offunctions.RenderDocAttributeto extend rendering ofattributes.RenderDocModuleto extend rendering ofmodules.RenderDocCallMixinto extend rendering of the common part parts offunctionsand classmethodsi.e. callables.RenderDocMembersMixinto extend rendering of the common parts ofmodulesandclassesi.e. objects with members.RenderLayoutto extend rendering of the Reference page.RenderSectionto extend rendering of a section/group of objecs on Reference page.RenderPageto 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.
modulesandattributesdo not have signatures so extending therender_signaturemethod would not have an effect.Install qrenderer stylesheets (s) into your
docdirectory.cd doc python -m qrenderer.stylesheets.install .
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, RenderDocClass
class Renderer(QRenderer):
pass
class _RenderDocClass(RenderDocClass):
def render_signature(self):
sig = super().render_signature()
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 annotationsThe 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 --*/