Skip to content

Commit

Permalink
Merge branch 'main' into doorstoprc
Browse files Browse the repository at this point in the history
  • Loading branch information
lbiaggi authored Sep 4, 2024
2 parents b5a56f4 + d4a14c0 commit 69c663d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion doorstop/core/publishers/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def create_matrix(self, directory):

def format_attr_list(self, item, linkify):
"""Create a Markdown attribute list for a heading."""
if settings.PUBLISH_MKDOCS:
return ""

return " {{#{u}}}".format(u=item.uid) if linkify else ""

def format_ref(self, item):
Expand Down Expand Up @@ -136,7 +139,7 @@ def lines(self, obj, **kwargs):
"""
linkify = kwargs.get("linkify", False)
toc = kwargs.get("toc", False)
if toc:
if toc and not settings.PUBLISH_MKDOCS:
yield self.table_of_contents(linkify=linkify, obj=obj)

yield from self._lines_markdown(obj, **kwargs)
Expand All @@ -148,6 +151,10 @@ def _generate_heading_from_item(self, item, to_html=False):
"""
result = ""
heading = "#" * item.depth

if settings.PUBLISH_MKDOCS:
heading = "#" * (item.depth + 1)

level = format_level(item.level)
if item.heading:
text_lines = item.text.splitlines()
Expand Down
1 change: 1 addition & 0 deletions doorstop/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
PUBLISH_CHILD_LINKS = True # include child links when publishing
PUBLISH_BODY_LEVELS = True # include levels on non-header items
PUBLISH_HEADING_LEVELS = True # include levels on header items
PUBLISH_MKDOCS = False # generate markdown for rendering by mkdocs
ENABLE_HEADERS = True # use headers if defined
WRITE_LINESEPERATOR = os.linesep

Expand Down

0 comments on commit 69c663d

Please sign in to comment.