Skip to content

Commit 0885f3f

Browse files
committed
fix: embed generation for links not found/auto citation
1 parent 6410472 commit 0885f3f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mkdocs_embed_file_plugins/plugin.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ def mini_ez_links(urlo, base, end, url_whitespace, url_case):
8888
internal_link = file_name
8989
file_path = internal_link.replace(base, '')
9090
url = file_path.replace('\\', '/').replace('.md', '')
91+
url = url_blog + '/' + quote(url)
9192
url = url.replace('//', '/')
92-
url = url_blog[:-1] + quote(url)
9393
if not url.startswith(('https:/', 'http:/')):
9494
url = 'https://' + url
9595
if not url.endswith('/') and not url.endswith(('png', 'jpg', 'jpeg', 'gif', 'webm')):
@@ -106,6 +106,8 @@ def strip_comments(markdown):
106106
markdown = re.sub(r'%%(.*)%%', '', markdown, flags=re.DOTALL)
107107
return markdown
108108

109+
110+
109111
def cite(md_link_path, link, soup, citation_part, config, callouts, custom_attr, msg) -> BeautifulSoup:
110112
"""Append the content of the founded file to the original file.
111113
@@ -132,6 +134,7 @@ def cite(md_link_path, link, soup, citation_part, config, callouts, custom_attr,
132134
new_uri = new_uri.replace('.md', '/')
133135
new_uri = new_uri.replace('//', '/')
134136
new_uri = re.sub('https?:\/', '\g<0>/', new_uri)
137+
new_uri = new_uri.replace('/index/', '/')
135138
input_file = codecs.open(str(md_link_path), mode='r', encoding='utf-8')
136139
text = input_file.read()
137140

@@ -172,6 +175,7 @@ def cite(md_link_path, link, soup, citation_part, config, callouts, custom_attr,
172175
)
173176
link_soup = BeautifulSoup(html, 'html.parser')
174177
if link_soup:
178+
175179
tooltip_template = (
176180
"<div class='citation'> <a href='"
177181
+ str(new_uri)

0 commit comments

Comments
 (0)