Skip to content

Commit

Permalink
Merge pull request #1853 from 4dn-dcic/bug_fix_markdown_code
Browse files Browse the repository at this point in the history
Bug Fix - Markdown JSON Content in Static Sections
  • Loading branch information
utku-ozturk authored Sep 29, 2023
2 parents c62dac1 + 339c811 commit 240f3b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ fourfront
Change Log
----------

6.4.5
=====

`Bug fix - markdown json content in static sections <https://github.com/4dn-dcic/fourfront/pull/1853>`_

* Json code sections in markdowns static content is not correctly rendered


6.4.4
=====

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
# Note: Various modules refer to this system as "encoded", not "fourfront".
name = "encoded"
version = "6.4.4"
version = "6.4.5"
description = "4DN-DCIC Fourfront"
authors = ["4DN-DCIC Team <support@4dnucleome.org>"]
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions src/encoded/types/user_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def content_as_html(self, request, body=None, file=None, options=None):
elif file_type == 'md':
# remove new line character
output = convert_markdown_to_html(content)
output = output.replace('\n', '')
# output = output.replace('\n', '')
if output and convert_ext_links:
return convert_external_links(output, request.domain)
return output
Expand Down Expand Up @@ -350,7 +350,7 @@ def get_remote_file_contents(uri):

def convert_markdown_to_html(markdown_text, custom_wrapper = 'div'):
# convert markdown to html including tables
html_output = markdown.markdown(markdown_text, extensions=['tables'])
html_output = markdown.markdown(markdown_text, extensions=['tables', 'fenced_code'])

# check content has any header, if yes wrap it with custom tag
header_pattern = re.compile(r'<h[1-6]>.*?<\/h[1-6]>', re.IGNORECASE)
Expand Down

0 comments on commit 240f3b6

Please sign in to comment.