From 76dec68c4514c2612ef9263b49c6ec7f4d77bd14 Mon Sep 17 00:00:00 2001 From: Hsiaoming Yang Date: Tue, 5 Apr 2022 09:17:30 +0900 Subject: [PATCH] Add documentation for renderer heading when TOC enabled ref: https://github.com/lepture/mistune/issues/251 --- docs/advanced.rst | 1 + docs/directives.rst | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/advanced.rst b/docs/advanced.rst index 7cd838b..a8f5a8b 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -37,6 +37,7 @@ Here is a a list of available renderer functions:: # block level paragraph(self, text) heading(self, text, level) + heading(self, text, level, tid) # when TOC directive is enabled thematic_break(self) block_text(self, text) block_code(self, code, info=None) diff --git a/docs/directives.rst b/docs/directives.rst index 7da75d6..9e7160a 100644 --- a/docs/directives.rst +++ b/docs/directives.rst @@ -75,6 +75,17 @@ TOC plugin:: plugins=[DirectiveToc()] ) +If **TOC** directive is enabled, the ``heading`` method of renderer will accept +one more paramter:: + + def heading(self, text, level): + # without TOC directive + return '' + + def heading(self, text, level, tid): + # with TOC directive + return '' + Include -------