Skip to content

Commit

Permalink
Merge pull request #220 from michaelnt/linkify_markdown
Browse files Browse the repository at this point in the history
Parent links are now links in markdown documents
  • Loading branch information
jacebrowning committed Feb 2, 2017
2 parents 13466bb + 531acb1 commit ef30946
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions doorstop/core/publisher.py
Expand Up @@ -43,7 +43,7 @@ def publish(obj, path, ext=None, linkify=None, index=None, **kwargs):
ext = ext or os.path.splitext(path)[-1] or '.html'
check(ext)
if linkify is None:
linkify = is_tree(obj) and ext == '.html'
linkify = is_tree(obj) and ext in ['.html', '.md']
if index is None:
index = is_tree(obj) and ext == '.html'

Expand Down Expand Up @@ -346,7 +346,7 @@ def _format_level(level):

def _format_md_attr_list(item, linkify):
"""Create a Markdown attribute list for a heading."""
return " {{: #{u} }}".format(u=item.uid) if linkify else ''
return " {{#{u} }}".format(u=item.uid) if linkify else ''


def _format_text_ref(item):
Expand Down
4 changes: 2 additions & 2 deletions doorstop/core/test/test_publisher.py
Expand Up @@ -201,7 +201,7 @@ def test_lines_markdown_item(self):

def test_lines_markdown_item_heading(self):
"""Verify Markdown can be published from an item (heading)."""
expected = "## 1.1 Heading {: #req3 }\n\n"
expected = "## 1.1 Heading {#req3 }\n\n"
# Act
lines = publisher.publish_lines(self.item, '.md', linkify=True)
text = ''.join(line + '\n' for line in lines)
Expand All @@ -211,7 +211,7 @@ def test_lines_markdown_item_heading(self):
@patch('doorstop.settings.PUBLISH_HEADING_LEVELS', False)
def test_lines_markdown_item_heading_no_heading_levels(self):
"""Verify an item heading level can be ommitted."""
expected = "## Heading {: #req3 }\n\n"
expected = "## Heading {#req3 }\n\n"
# Act
lines = publisher.publish_lines(self.item, '.md', linkify=True)
text = ''.join(line + '\n' for line in lines)
Expand Down

0 comments on commit ef30946

Please sign in to comment.