Commits

mitar  committed 78f743c

Made heading offsetting configurable.

  • Participants
  • Parent commits 5a791f7

Comments (0)

Files changed (2)

     }
 
 ``CMS_MARKUP_TRAC_COMPONENTS`` configures which additional Trac plugins (components) should be enabled. They should of course be in Python path.
+
+``CMS_MARKUP_TRAC_HEADING_OFFSET`` configures the heading offset when rendering wiki syntax. Useful when you are including wiki content inside some other content with existing headings. Default is 1 which means that ``= Heading =`` becomes ``<h2>Heading</h2>``.

File cmsplugin_markup_tracwiki/tracwiki.py

 class DjangoFormatter(wiki.formatter.Formatter):
     def _parse_heading(self, match, fullmatch, shorten):
         (depth, heading, anchor) = super(DjangoFormatter, self)._parse_heading(match, fullmatch, shorten)
-        depth = min(depth + TRACWIKI_HEADER_OFFSET, 6)
+        depth = min(depth + getattr(settings, 'CMS_MARKUP_TRAC_HEADING_OFFSET', 1), 6)
         return (depth, heading, anchor)
     
     def _make_lhref_link(self, match, fullmatch, rel, ns, target, label):