Skip to content
This repository was archived by the owner on May 21, 2022. It is now read-only.

Commit 400ca89

Browse files
committed
style: use another id for image in md
1 parent 423c884 commit 400ca89

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

md2docx/GeneratedCode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2098,7 +2098,7 @@ public static Run GenerateImageReference(int id, long width, long height)
20982098
nonVisualPictureProperties1.Append(nonVisualPictureDrawingProperties1);
20992099

21002100
Pic.BlipFill blipFill1 = new Pic.BlipFill();
2101-
A.Blip blip1 = new A.Blip() { Embed = $"rId{id}" };
2101+
A.Blip blip1 = new A.Blip() { Embed = $"image{id}" };
21022102

21032103
A.Stretch stretch1 = new A.Stretch();
21042104
A.FillRectangle fillRectangle1 = new A.FillRectangle();

md2docx/md2docx.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Md2Docx
2323
static Dictionary<int, byte[]> imageDatas = new Dictionary<int, byte[]>();
2424
static Dictionary<int, string> imageType = new Dictionary<int, string>();
2525
static List<int> failImage = new List<int>();
26-
static int imageCount = 3;
26+
static int imageCount = 1;
2727
static bool hasFailImage = false;
2828

2929
/// <summary>
@@ -120,7 +120,7 @@ private static void Main(string[] args)
120120

121121
foreach(int index in imageType.Keys)
122122
{
123-
ImagePart imagePart = mainDocumentPart1.AddNewPart<ImagePart>($"image/{imageType[index]}", $"rId{index}");
123+
ImagePart imagePart = mainDocumentPart1.AddNewPart<ImagePart>($"image/{imageType[index]}", $"image{index}");
124124
imagePart.FeedData(new MemoryStream(imageDatas[index]));
125125
}
126126
}
@@ -273,7 +273,7 @@ private static void CovertMDInlines(RunProperties rp, IList<MarkdownInline> inli
273273
ImageGetter image = new ImageGetter();
274274
if (!image.Load(img.Url))
275275
{
276-
failImage.Add(imageCount - 2);
276+
failImage.Add(imageCount);
277277
hasFailImage = true;
278278
}
279279
imageType.Add(imageCount, image.Type);

0 commit comments

Comments
 (0)