Skip to content

Commit 4ffe4c2

Browse files
committed
fix: #28 markdown image title
1 parent e96d5b2 commit 4ffe4c2

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

app/Coding.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ public function createMarkdownZip($markdown, $path, $markdownFilename): bool|str
7272
preg_match_all('/!\[\]\((.+)\)/', $markdown, $matches);
7373
if (!empty($matches)) {
7474
foreach ($matches[1] as $attachment) {
75-
$this->zipArchive->addFile($path . $attachment, $attachment);
75+
// markdown image title: ![](images/default.svg "admin")
76+
$tmp = explode(' ', $attachment);
77+
$filename = $tmp[0];
78+
$this->zipArchive->addFile($path . $filename, $filename);
7679
}
7780
}
7881
$this->zipArchive->close();

tests/data/confluence/space1/image-demo_65619.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ <h3 style="text-align: left;" id="helloworld-1.2Whydoweuseit?">1.2 Why do we use
6363
data-linked-resource-container-id="65619" data-linked-resource-container-version="4"></span></p>
6464
<p>
6565
<h2 id="helloworld-第二章">第二章</h2>
66+
<a class="confluence-userlink url fn" data-username="admin" href=""><img class="userLogo logo" src="images/icons/profilepics/default.svg" alt="" title="admin"></a>
6667
<p>world</p>
6768
<p><span class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img
6869
class="confluence-embedded-image" height="250" src="attachments/65619/65623.png"
Lines changed: 18 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)