Skip to content

Commit 57108ae

Browse files
✨ Add Markdown Processing Features and Update Dependencies
- Introduce ManagerMd for Markdown processing, enabling conversion to Word and HTML, and extraction of tables to Excel. - Update README files (English and Chinese) with new Markdown processing examples. - Add tests for Markdown conversion functionalities in test_etool.py. - Include new dependencies: markdown and beautifulsoup4 in pyproject.toml.
1 parent 8f8af94 commit 57108ae

File tree

11 files changed

+523
-3
lines changed

11 files changed

+523
-3
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,21 @@ ManagerIpynb.merge_notebooks(ipynb_dir) # Merge ipynb files
137137
ManagerIpynb.convert_notebook_to_markdown(ipynb_dir+'.ipynb', md_dir) # Convert ipynb files to md files
138138
```
139139

140+
## Markdown Processing
141+
142+
```python
143+
from etool import ManagerMd
144+
145+
# Convert Markdown to Word document
146+
ManagerMd.convert_md_to_docx("document.md", "document.docx")
147+
148+
# Convert Markdown to HTML webpage
149+
ManagerMd.convert_md_to_html("document.md", "document.html")
150+
151+
# Extract tables from Markdown to Excel
152+
ManagerMd.extract_tables_to_excel("document.md", "tables.xlsx")
153+
```
154+
140155
## Others
141156

142157
### Task Scheduling
@@ -216,7 +231,7 @@ print(ManagerPassword.convert_base("Z", 36, 10))
216231
from etool import ManagerInstall
217232
ManagerInstall.install(requirements_file="requirements.txt", failed_file="failed_requirements.txt", retry=2)
218233
# Automatically install dependencies, retry 2 times if installation fails, skip installation if successful. The above are default parameters.
219-
# You can also use the default parameters without specifying parameters.
234+
# You can also use the default parameters without specifying parameters.
220235
ManagerInstall.install()
221236
```
222237

README_CN.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,21 @@ ManagerIpynb.merge_notebooks(ipynb_dir) # 合并ipynb文件
138138
ManagerIpynb.convert_notebook_to_markdown(ipynb_dir+'.ipynb', md_dir) # 将ipynb文件转换为md文件
139139
```
140140

141+
## Markdown处理
142+
143+
```python
144+
from etool import ManagerMd
145+
146+
# 将Markdown转换为Word文档
147+
ManagerMd.convert_md_to_docx("document.md", "document.docx")
148+
149+
# 将Markdown转换为HTML网页
150+
ManagerMd.convert_md_to_html("document.md", "document.html")
151+
152+
# 从Markdown提取表格到Excel
153+
ManagerMd.extract_tables_to_excel("document.md", "tables.xlsx")
154+
```
155+
141156
## 其他
142157

143158
### 任务调度
@@ -191,7 +206,6 @@ ManagerScheduler.parse_schedule_time(120)
191206
ManagerScheduler.parse_schedule_time("08:00")
192207
ManagerScheduler.parse_schedule_time(["08:00", "12:00", "16:00"])
193208
ManagerScheduler.parse_schedule_time({1: "08:00", 2: ["08:00", "12:00", "16:00"], 3: 216000, "1": "08:00"})
194-
195209
```
196210

197211
### 密码生成与进制转换

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ dependencies = [
3535
"scikit-image",
3636
"pywin32",
3737
"pdf2docx",
38-
"etool"
38+
"etool",
39+
"markdown",
40+
"beautifulsoup4"
3941
]
4042

4143
[project.urls]

src/etool/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from ._office._ipynb import ManagerIpynb
1414
from ._office._qrcode import ManagerQrcode
1515
from ._office._pdf import ManagerPdf
16+
from ._md._md_to_docx import ManagerMd
1617

1718
__all__ = [
1819
"ManagerSpeed",
@@ -28,4 +29,5 @@
2829
"ManagerIpynb",
2930
"ManagerQrcode",
3031
"ManagerPdf",
32+
"ManagerMd",
3133
]

src/etool/_md/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from ._md_to_docx import ManagerMd
2+
3+
__all__ = ["ManagerMd"]
4+

0 commit comments

Comments
 (0)