Skip to content

Commit bdf6c67

Browse files
committed
html to markdown
1 parent dd906df commit bdf6c67

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Script Name
2+
3+
HTML to Markdown
4+
5+
## Short description of script
6+
7+
This script can be used to convert any file with HTML code into markdown(.md) format.
8+
9+
## Setup instructions
10+
11+
- Install the required packages by running the command `pip install -r requirements.txt`
12+
- Download the script.
13+
- To run the script use the command `python html_to_markdown.py`
14+
- Enter the path of HTML i.e. the location where it is present on your local machine.
15+
- The script will create a markdown file named `markdown_file.md` in the location where the script was present.
16+
17+
18+
## Input and Output
19+
20+
- Sample HTML file
21+
22+
<img src = "https://imgur.com/zFhnG9F.png">
23+
24+
- Output markdown file
25+
26+
<img src = "https://imgur.com/f1hZKsg.png">
27+
28+
## Author(s)
29+
30+
[Tanvi Bugdani](https://github.com/tanvi355)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#import markdownify
2+
import markdownify
3+
4+
#taking html file as input
5+
try:
6+
html_file = input('Enter HTML file path: ')
7+
html = open(html_file, "r")
8+
except:
9+
print('No file selected')
10+
11+
#creating a new markdown file
12+
with open('markdown_file.md', 'w') as md_file:
13+
#convert html code to markdown format
14+
for data in html:
15+
md_file.write(markdownify.markdownify(data))
16+
md_file.write("\n")
17+
md_file.close()
18+
19+
print('Conversion successfull')
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mardownify==0.9.0

0 commit comments

Comments
 (0)