File tree Expand file tree Collapse file tree 3 files changed +50
-0
lines changed
BasicPythonScripts/HTML to markdown Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change
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 )
Original file line number Diff line number Diff line change
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' )
Original file line number Diff line number Diff line change
1
+ mardownify == 0.9.0
You can’t perform that action at this time.
0 commit comments