Skip to content

Commit 4b4a964

Browse files
authored
Merge pull request #10 from soryu-ryouji/dev
chore: bump version to 0.2.0
2 parents 50c73bb + 6a44fad commit 4b4a964

File tree

4 files changed

+53
-16
lines changed

4 files changed

+53
-16
lines changed

MarkdownEpubUtility/MarkdownEpubUtility.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<TargetFramework>net8.0</TargetFramework>
88
<ImplicitUsings>enable</ImplicitUsings>
99
<Nullable>enable</Nullable>
10-
<Version>0.1.3.1</Version>
10+
<Version>0.2.0</Version>
1111
<PackageProjectUrl>https://github.com/soryu-ryouji/MarkdownEpubUtility/</PackageProjectUrl>
1212
<Description>
1313
A .NET library for converting epub and markdown to each other.

MarkdownEpubUtility/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ By using the 'SplitLevel' parameter, it is possible to achieve the segmentation
77
**Example**
88

99
```csharp
10+
// Build Epub
1011
var epubMetadata = new EpubMetadata
1112
{
1213
Title = "The Art of Unix Programming",
@@ -22,4 +23,17 @@ var buildMetadata = new BuildMetadata(mdPath, coverPath, pageSplitLevel:1);
2223

2324
var epub = new EpubBook(epubMetadata, buildMetadata);
2425
epub.CreateEpub(buildPath);
26+
27+
// Open Book
28+
var book = EpubBook.OpenBook(@"D:\The Art of Unix Programming.epub");
29+
Console.WriteLine(book.Metadata);
30+
var imageList = book.ExtractImage();
31+
32+
var imagePath = @"D:\images\";
33+
if (!Directory.Exists(imagePath)) Directory.CreateDirectory(imagePath);
34+
foreach (var image in items)
35+
{
36+
var filePath = Path.Combine(imagePath, image.FileName);
37+
File.WriteAllBytes(filePath, image.Content);
38+
}
2539
```

README-zh.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,44 @@
22

33
## Markdown Epub Utility
44

5+
[![NuGet Version](https://img.shields.io/nuget/v/MarkdownEpubUtility)](https://www.nuget.org/packages/MarkdownEpubUtility)
6+
57
Markdown Epub Utility 是一个将 Markdown 文档转换为 Epub 电子书的跨平台的库。
68

79
通过 `SplitLevel` 参数,可以实现电子书内容的分割显示,避免了所有内容挤在一张 `html`中造成了加载迟缓。
810

9-
1011
**Example**
1112

1213
```c#
14+
// Build Epub
1315
var epubMetadata = new EpubMetadata
1416
{
15-
Title = "太原之恋",
16-
Language = "zh",
17-
Author = "刘慈欣",
17+
Title = "The Art of Unix Programming",
18+
Language = "en",
19+
Author = "Eric S. Raymond",
1820
};
1921

20-
var mdPath = @"D:\Books\Novel\太原之恋\太原之恋.md";
21-
var coverPath = @"D:\Books\Novel\太原之恋\cover.jpg";
22-
var buildPath = @"D:\太原之恋.epub";
22+
var mdPath = @"D:\Books\Novel\TheArtofUnixProgramming\TheArtofUnixProgramming.md";
23+
var coverPath = @"D:\Books\Novel\TheArtofUnixProgramming\cover.jpg";
24+
var buildPath = @"D:\TheArtofUnixProgramming.epub";
2325

2426
var buildMetadata = new BuildMetadata(mdPath, coverPath, pageSplitLevel:1);
2527

26-
var epub = new Epub(epubMetadata, buildMetadata);
27-
epub.CreateEpub().Save(buildPath);
28+
var epub = new EpubBook(epubMetadata, buildMetadata);
29+
epub.CreateEpub(buildPath);
30+
31+
// Open Book
32+
var book = EpubBook.OpenBook(@"D:\The Art of Unix Programming.epub");
33+
Console.WriteLine(book.Metadata);
34+
var imageList = book.ExtractImage();
35+
36+
var imagePath = @"D:\images\";
37+
if (!Directory.Exists(imagePath)) Directory.CreateDirectory(imagePath);
38+
foreach (var image in items)
39+
{
40+
var filePath = Path.Combine(imagePath, image.FileName);
41+
File.WriteAllBytes(filePath, image.Content);
42+
}
2843
```
2944

3045
## Markdown Epub Utility CLI
@@ -46,12 +61,6 @@ epub.CreateEpub().Save(buildPath);
4661
eb build -m E:\天之炽\天之炽.md -c E:\天之炽\cover.jpg -b E:\天之炽\天之炽.epub -s 2
4762
```
4863

49-
# Docs
50-
51-
[Epub 电子书格式介绍](./docs/Epub电子书格式.md)
52-
53-
[EpubBuilder执行流程](./docs//EpubBuilder执行流程.md)
54-
5564
# LICENSE
5665

5766
![MIT](./docs/images/MIT.png)

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ By using the 'SplitLevel' parameter, it is possible to achieve the segmentation
1313
**Example**
1414

1515
```csharp
16+
// Build Epub
1617
var epubMetadata = new EpubMetadata
1718
{
1819
Title = "The Art of Unix Programming",
@@ -28,6 +29,19 @@ var buildMetadata = new BuildMetadata(mdPath, coverPath, pageSplitLevel:1);
2829

2930
var epub = new EpubBook(epubMetadata, buildMetadata);
3031
epub.CreateEpub(buildPath);
32+
33+
// Open Book
34+
var book = EpubBook.OpenBook(@"D:\The Art of Unix Programming.epub");
35+
Console.WriteLine(book.Metadata);
36+
var imageList = book.ExtractImage();
37+
38+
var imagePath = @"D:\images\";
39+
if (!Directory.Exists(imagePath)) Directory.CreateDirectory(imagePath);
40+
foreach (var image in items)
41+
{
42+
var filePath = Path.Combine(imagePath, image.FileName);
43+
File.WriteAllBytes(filePath, image.Content);
44+
}
3145
```
3246

3347
### To do List

0 commit comments

Comments
 (0)