Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/12 #26

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = confluence.md
version = 0.4.5
version = 0.4.6
author = Szymon Nieradka
description = Markdown to Confluence - upload any .md files to your Confluence cloud page
long_description = file: README.md
Expand Down
1 change: 0 additions & 1 deletion src/md2cf/utils/confluencemd.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ def __attach_images(
) -> None:
"""Replaces <img> html tags with Confluence specific <ac:image> and uploads
images as attachements"""
logger.info("__attach_images %s", page_id)
for (_alt, path) in images:
rel_path = os.path.join(self.md_file_dir, path)
if not os.path.isfile(rel_path):
Expand Down
8 changes: 8 additions & 0 deletions src/md2cf/utils/md2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def md_to_html(md_file: str,

md_file_dir = os.path.dirname(md_file)
html = __rewrite_images(html, md_file_dir, images)
html = __fix_code_blocks(html)
return html, page_id_from_meta, url, images

def __parse_confluence_url(meta: Dict[str, str]) -> Tuple[Optional[str], Optional[str]]:
Expand Down Expand Up @@ -100,6 +101,13 @@ def __rewrite_images(html: str,
logger.warning("image tag `%s` not found in html", old)
return html

def __fix_code_blocks(html: str) -> str:
"""
@TODO temporary fix for https://github.com/szn/confluence.md/issues/12
"""
html = html.replace('<pre><code>', '<code>')
return html.replace("</code></pre>", "</code>")

def __get_file_contents(file: str) -> str:
"""Return file contents"""
with open(file, "r", encoding="utf-8") as stream:
Expand Down
Loading