summaryrefslogtreecommitdiff
path: root/giscanner/mdextensions.py
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2015-11-15 21:46:12 -0500
committerrockon999 <rockon999@users.noreply.github.com>2018-08-06 02:53:45 -0500
commit7f67146d8254464f396b289ed41c8954d61fe03d (patch)
treeee37ec817a11baf293664d36086c6d010177e409 /giscanner/mdextensions.py
parent19c03a46b14f379cfd4ad93e34133312b754efea (diff)
downloadgobject-introspection-7f67146d8254464f396b289ed41c8954d61fe03d.tar.gz
doctool: Output formatter for DevDocs
In order to generate HTML output that DevDocs can easily scrape and display, we add a new output format to g-ir-doc-tool (--format=devdocs). It works similarly to the Mallard output format, but generates very simple HTML instead. We add a new set of Mako templates to generate this output.
Diffstat (limited to 'giscanner/mdextensions.py')
-rw-r--r--giscanner/mdextensions.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/giscanner/mdextensions.py b/giscanner/mdextensions.py
new file mode 100644
index 00000000..97be4ed1
--- /dev/null
+++ b/giscanner/mdextensions.py
@@ -0,0 +1,14 @@
+from markdown.extensions import Extension
+from markdown.treeprocessors import Treeprocessor
+from markdown.util import etree
+
+
+class RemoveOuterP(Treeprocessor):
+ def run(self, root):
+ if len(root) == 1 and root[0].tag == "p":
+ root[0].tag = "span"
+
+
+class InlineMarkdown(Extension):
+ def extendMarkdown(self, md, md_globals):
+ md.treeprocessors.add("remove_outer_p", RemoveOuterP(md), "_end")