Skip to content

Commit 8e61000

Browse files
authored
Merge pull request #20 from shloktech/updating-readme
Updating readme
2 parents dd4f3a4 + 47e9ef5 commit 8e61000

1 file changed

Lines changed: 43 additions & 7 deletions

File tree

Readme.md

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,56 @@ You need to have Python installed on your system along with the following librar
2626
- `python-docx` for creating and editing Word documents.
2727
- `beautifulsoup4` for parsing HTML.
2828

29-
You can install the required libraries using pip:
29+
Sure, let's enhance your instructions for clarity and completeness:
30+
31+
---
32+
33+
### How to Convert Markdown to Word Using `md2docx-python`
34+
35+
#### Step 1: Install the Required Library
36+
First, you need to install the `md2docx-python` library using pip. Open your terminal and run the following command:
3037

3138
```bash
32-
pip install -r requirements.txt
39+
pip install md2docx-python
3340
```
3441

35-
To run the sample files follow the below steps:
42+
#### Step 2: Import the Library in Your Code
43+
To use the library, import it into your Python code with the following line:
3644

37-
```bash
38-
python md2docx_python.py
39-
Enter the path to the Markdown file (e.g., README.md): ..\sample_files\amazon_case_study.md
40-
Enter the path for the output Word file (e.g., README.docx): ..\sample_files\amazon_case_study.docx
45+
```python
46+
from md2docx_python.src.md2docx_python import markdown_to_word
47+
```
48+
49+
#### Step 3: Convert Markdown to Word
50+
Call the `markdown_to_word()` function to convert your Markdown file to a Word document. Here's the syntax:
51+
52+
```python
53+
markdown_to_word(markdown_file, word_file)
54+
```
55+
56+
- `markdown_file`: The path to the Markdown file you want to convert.
57+
- `word_file`: The desired path and name for the output Word document.
58+
59+
#### Step 4: Sample Code
60+
Here's a complete example to illustrate how it works:
61+
62+
```python
63+
from md2docx_python.src.md2docx_python import markdown_to_word
64+
65+
# Define the paths to your files
66+
markdown_file = "sample_files/amazon_case_study.md"
67+
word_file = "sample_files/amazon_case_study.docx"
68+
69+
# Convert the Markdown file to a Word document
70+
markdown_to_word(markdown_file, word_file)
4171
```
4272

73+
This code will create a file named `amazon_case_study.docx`, which is the conversion of `amazon_case_study.md` to the Word format.
74+
75+
---
76+
77+
This should make it easier to understand and follow the steps. Let me know if you need any more help or further enhancements!
78+
4379
## Why this repo and not others ?
4480

4581
Here are some reasons why this repo might be considered better or more suitable for certain use cases compared to other scripts available on the internet:

0 commit comments

Comments
 (0)