Browse Source

【修复,渲染】data_url 图片无法渲染

使 MD 文件中以 data_url 嵌入的图片能正常渲染。
PJ568 11 tháng trước cách đây
mục cha
commit
e9d8ce05e9
1 tập tin đã thay đổi với 7 bổ sung và 2 xóa
  1. 7 2
      index.html

+ 7 - 2
index.html

@@ -2,7 +2,7 @@
 
 
 <html>
 <html>
   <markdown-html
   <markdown-html
-    version="1.20.6"
+    version="1.20.7"
     author="PJ568"
     author="PJ568"
     repo="https://github.com/PJ-568/markdown.html"
     repo="https://github.com/PJ-568/markdown.html"
     license="CC BY-SA 4.0 International"
     license="CC BY-SA 4.0 International"
@@ -634,7 +634,12 @@
           images.forEach((img) => {
           images.forEach((img) => {
             const src = img.getAttribute("src");
             const src = img.getAttribute("src");
             img.setAttribute("loading", "lazy");
             img.setAttribute("loading", "lazy");
-            if (src && !isExternalLink(src) && isRelativePath(src)) {
+            if (
+              src &&
+              !src.startsWith("data:") &&
+              !isExternalLink(src) &&
+              isRelativePath(src)
+            ) {
               var absolutePath = pValue
               var absolutePath = pValue
                 ? getDirectory(mdPath) + src
                 ? getDirectory(mdPath) + src
                 : getPath() + src;
                 : getPath() + src;