diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dbef035 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +mkdocs_with_confluence/__pycache__/* +mkdocs_with_confluence.egg-info/* diff --git a/mkdocs_with_confluence/plugin.py b/mkdocs_with_confluence/plugin.py index 93ccd16..95b0e82 100644 --- a/mkdocs_with_confluence/plugin.py +++ b/mkdocs_with_confluence/plugin.py @@ -1,5 +1,6 @@ import time import os +import hashlib import sys import re import tempfile @@ -211,16 +212,19 @@ class MkdocsWithConfluence(BasePlugin): tf = tempfile.NamedTemporaryFile(delete=False) f = open(tf.name, "w") - files = [] + attachments = [] try: for match in re.finditer(r'img src="file://(.*)" s', markdown): if self.config["debug"]: print(f"DEBUG - FOUND IMAGE: {match.group(1)}") - files.append(match.group(1)) + attachments.append(match.group(1)) + for match in re.finditer(r"!\[[\w\. -]*\]\((?!http|file)(.*)\)", markdown): + if self.config["debug"]: + print(f"DEBUG - FOUND IMAGE: {match.group(1)}") + attachments.append("docs/" + match.group(1)) except AttributeError as e: if self.config["debug"]: print(f"DEBUG - WARN(({e}): No images found in markdown. Proceed..") - new_markdown = re.sub( r'