-
Notifications
You must be signed in to change notification settings - Fork 29
Feat/lesson01/readme-html-conversion-WayleomVargas #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8a765ba
e491dba
0dc0c7d
e335b3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<head> | ||
<link rel="stylesheet" href="MarkdownCSS.css"> | ||
</head> | ||
<html> | ||
<body> | ||
<h1>Wayleom Vargas README</h1> | ||
<h2>Introduction</h2> | ||
<p>My name is Wayleom Vargas Rubio. I grew up in the Bronx from New York city. I moved to Delaware in my junior year of high school and graduated from Delaware State University. I majored in Information Technology and have a love for reading scientific articles.</p> | ||
<h2>My work hours</h2> | ||
<p>I am not a morning person but have the ability to wake up early when needed. For a normal scheduled weekday when I have to work, I can be contacted starting at 9am. Throughout the day I should be reachable and I keep myself open until 6pm. During the weekends I am unavailable unless discussed with prior.</p> | ||
<h2>Best way to communicate with me</h2> | ||
<p>I prefer to communicate with anyone through google chat or discord. For longer messages or documents please use my email. If I am working with a group on something important I prefer to be contacted over sms.</p> | ||
<h2>How do I give feedback</h2> | ||
<p>I give my feedback straight and to the point. I will try to be considerate.</p> | ||
<h2>How I prefer my feedback</h2> | ||
<p>I prefer my feed back straight to the point, if there are areas I need to improve let me know immediately.</p> | ||
<h2>Topics I like to talk about</h2> | ||
<p>I like to talk about technology, science, video games, and tv shows. If anyone has some interests they want to share with my, I would be happy to listen.</p> | ||
<h2>Goals</h2> | ||
<p>I aspire to become a Cybersecurity Professional on the Blue Team. I also want to learn new technologies to keep myself more relevant within my field. The first step in my career is to receive proper certifications such as the Security+, CySA+ , Red Hat, and PenTest+. The end goal is to be a Cloud Security Engineer or CTO if possible. I also want to set up my homelab this month to practice my skills.</p> | ||
<h2>Photos</h2> | ||
<img src="images/IMG_0660.jpg" height=400> | ||
<img src="images/IMG_0681.jpg" height=400> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
body { | ||
font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; | ||
line-height: 1.6; | ||
max-width: 800px; | ||
margin: 2rem auto; | ||
padding: 0 1rem; | ||
color: #24292f; | ||
background-color: #ffffff; | ||
} | ||
|
||
h1, h2, h3, h4, h5, h6 { | ||
font-weight: 600; | ||
margin-top: 1.5em; | ||
margin-bottom: 0.5em; | ||
line-height: 1.25; | ||
} | ||
|
||
h1 { font-size: 2em; border-bottom: 1px solid #eaecef; padding-bottom: 0.3em; } | ||
h2 { font-size: 1.5em; border-bottom: 1px solid #eaecef; padding-bottom: 0.3em; } | ||
h3 { font-size: 1.25em; } | ||
h4 { font-size: 1.1em; } | ||
h5 { font-size: 1em; } | ||
h6 { font-size: 0.9em; color: #6a737d; } | ||
|
||
p { | ||
margin: 1em 0; | ||
} | ||
|
||
ul, ol { | ||
margin: 1em 0; | ||
padding-left: 2em; | ||
} | ||
|
||
li { | ||
margin: 0.25em 0; | ||
} | ||
|
||
code { | ||
font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; | ||
background-color: #f6f8fa; | ||
padding: 0.2em 0.4em; | ||
border-radius: 3px; | ||
font-size: 85%; | ||
} | ||
|
||
pre { | ||
background-color: #f6f8fa; | ||
padding: 1em; | ||
overflow: auto; | ||
border-radius: 6px; | ||
font-size: 0.9em; | ||
} | ||
|
||
pre code { | ||
background: none; | ||
padding: 0; | ||
font-size: 100%; | ||
} | ||
|
||
a { | ||
color: #0366d6; | ||
text-decoration: none; | ||
} | ||
|
||
a:hover { | ||
text-decoration: underline; | ||
} | ||
|
||
blockquote { | ||
margin: 1em 0; | ||
padding: 0.5em 1em; | ||
color: #6a737d; | ||
border-left: 0.25em solid #dfe2e5; | ||
background-color: #f6f8fa; | ||
} | ||
|
||
hr { | ||
border: 0; | ||
height: 1px; | ||
background: #e1e4e8; | ||
margin: 2em 0; | ||
} | ||
|
||
table { | ||
border-collapse: collapse; | ||
width: 100%; | ||
margin: 1em 0; | ||
} | ||
|
||
th, td { | ||
border: 1px solid #dfe2e5; | ||
padding: 0.6em 1em; | ||
text-align: left; | ||
} | ||
|
||
th { | ||
background-color: #f6f8fa; | ||
font-weight: 600; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Wayleom Vargas Rubio README | ||
|
||
## Introduction | ||
My name is Wayleom Vargas Rubio. I grew up in the Bronx from New York city. I moved to Delaware in my junior year of high school and graduated from Delaware State University. I majored in Information Technology and have a love for reading scientific articles. | ||
|
||
## My work hours | ||
I am not a morning person but have the ability to wake up early when needed. For a normal scheduled weekday when I have to work, I can be contacted starting at 9am. Throughout the day I should be reachable and I keep myself open until 6pm. During the weekends I am unavailable unless discussed with prior. | ||
|
||
## Best way to communicate with me | ||
I prefer to communicate with anyone through google chat or discord. For longer messages or documents please use my email. If I am working with a group on something important I prefer to be contacted over sms. | ||
|
||
## How do I give feedback | ||
I give my feedback straight and to the point. I will try to be considerate. | ||
|
||
## How I prefer my feedback | ||
I prefer my feed back straight to the point, if there are areas I need to improve let me know immediately. | ||
|
||
## Topics I like to talk about | ||
I like to talk about technology, science, video games, and tv shows. If anyone has some interests they want to share with my, I would be happy to listen. | ||
|
||
## Goals | ||
I aspire to become a Cybersecurity Professional on the Blue Team. I also want to learn new technologies to keep myself more relevant within my field. The first step in my career is to receive proper certifications such as the Security+, CySA+ , Red Hat, and PenTest+. The end goal is to be a Cloud Security Engineer or CTO if possible. I also want to set up my homelab this month to practice my skills. | ||
|
||
## Photos | ||
<img src="images/IMG_0660.jpg" height=400> | ||
<img src="images/IMG_0681.jpg" height=400> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Markdown to HTML converver | ||
|
||
# Description | ||
This python script will open the desired README file and convert it to an HTML file. It has a bash file that can be used to activate it. | ||
|
||
# Used Files | ||
The files that are used goes as followed | ||
- conversion.py | ||
- MarkdownCSS.css | ||
- convert.sh | ||
- test.html | ||
- README.md | ||
|
||
# How to use | ||
To be able to run this the intended way you must make the bash file executable. To do that you must run the command **chmod +x convert.sh**. Afterwards you have to run the bash script. This can be done by using the command **./convert.sh README.md** which will create a file called test.html with the converted README. This can be done with any markdown file, all you have to do is change the name of the file within the command. (README.md is my example) | ||
|
||
# Dependencies | ||
This code uses no outside libraries so there is no need to download anything. The only library that is being imported is the system library (ie import sys) | ||
|
||
# Notes | ||
This is a very rudimentary python script as it only does the most basic of basic tasks, so do not expect a perfect one to one creation. That is because I only accounted for the creation of headers and body tags being used throughout the document. So no lists or emboldened words. It also does not follow basic indentation for an html file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import sys | ||
|
||
#Bash script version | ||
|
||
def html_converter(md_filename): | ||
html_filename = "test.html" # output file fixed | ||
|
||
with open(md_filename, 'r') as readme, open(html_filename, 'w') as test: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the var name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's referencing the opened file, I should have named it something more meaningful like text as you sugested. I will keep that in mind for next time. |
||
test.write("<!DOCTYPE html>\n<html>\n<body>\n") | ||
test.write('<head>\n<link rel="stylesheet" href="MarkdownCSS.css">\n</head>\n') | ||
|
||
for line in readme: | ||
line = line.rstrip('\n') | ||
if line.strip() == "": | ||
continue | ||
|
||
count = 0 | ||
for char in line: | ||
if char == '#' and count < 6: | ||
count += 1 | ||
else: | ||
break | ||
|
||
content = line[count:].strip() | ||
|
||
if count > 0: | ||
test.write(f"<h{count}>{content}</h{count}>\n") | ||
else: | ||
test.write(f"<p>{content}</p>\n") | ||
|
||
test.write("</body>\n</html>") | ||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) != 2: | ||
print("Usage: python3 conversion.py <markdown_file>") | ||
sys.exit(1) | ||
html_converter(sys.argv[1]) | ||
print(f"Converted {sys.argv[1]} to test.html") | ||
|
||
|
||
# def ContentPrinter(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should almost never commit commented out code that doesn't do anything. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I won't do it again; it was so I could have referenced some steps I did before to remind myself how i got the conclusion. |
||
# f = open("README.md","r") | ||
# print(f.read()) | ||
|
||
# ContentPrinter() | ||
|
||
# def CreateAFIle(): | ||
# f = open("test.txt", "x") | ||
# f.write("This is a test") | ||
# CreateAFIle() | ||
|
||
# def ContentCopy(): | ||
# with open('README.md','r') as README, open('test.html','a') as test: | ||
|
||
# # read content from first file | ||
# for line in README: | ||
|
||
# # append content to second file | ||
# test.write(line) | ||
|
||
# ContentCopy() | ||
|
||
# def html_converter(): | ||
# with open('README.md','r') as README, open('test.html','a') as test: | ||
# test.write("<!DOCTYPE html> \n") | ||
# for line in README: | ||
# str(line) | ||
# stripped = line.strip() | ||
|
||
# if '#' in line[0]: | ||
# newline = line.rstrip('\n') | ||
# count = len(stripped) - len(stripped.lstrip('#')) | ||
# content = stripped[count:].strip() # Remove the # symbols and extra space | ||
# test.write("<h1>") | ||
# test.write(f"<h{count}>{newline}</h{count}>\n") | ||
# test.write("</h1>") | ||
# test.write(line) | ||
|
||
# html_converter() | ||
|
||
#None Bash Script Version | ||
# def html_converter(md_filename): | ||
# html_filename = "test.html" | ||
|
||
# with open(md_filename, 'r') as readme, open(html_filename, 'w') as test: | ||
# test.write("<!DOCTYPE html>\n<html>\n<body>\n") | ||
# test.write('<head>\n<link rel="stylesheet" href="MarkdownCSS.css">\n</head>\n') | ||
|
||
# for line in readme: | ||
# line = line.rstrip('\n') | ||
# if line.strip() == "": | ||
# continue | ||
|
||
# count = 0 | ||
# for char in line: | ||
# if char == '#' and count < 6: | ||
# count += 1 | ||
# else: | ||
# break | ||
|
||
# content = line[count:].strip() | ||
|
||
# if count > 0: | ||
# test.write(f"<h{count}>{content}</h{count}>\n") | ||
# else: | ||
# test.write(f"<p>{content}</p>\n") | ||
|
||
# test.write("</body>\n</html>") | ||
|
||
# html_converter("README.md") | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
if [ $# -ne 1 ]; then | ||
echo "Usage: $0 <markdown_file>" | ||
exit 1 | ||
fi | ||
|
||
rm -f test.html | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So it deletes the existing test.html file every time it runs. I got tired of manually deleting it myself so i added it to the bash script. |
||
|
||
python3 conversion.py "$1" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<head> | ||
<link rel="stylesheet" href="MarkdownCSS.css"> | ||
</head> | ||
<h1>Wayleom Vargas Rubio README</h1> | ||
<h2>Introduction</h2> | ||
<p>My name is Wayleom Vargas Rubio. I grew up in the Bronx from New York city. I moved to Delaware in my junior year of high school and graduated from Delaware State University. I majored in Information Technology and have a love for reading scientific articles.</p> | ||
<h2>My work hours</h2> | ||
<p>I am not a morning person but have the ability to wake up early when needed. For a normal scheduled weekday when I have to work, I can be contacted starting at 9am. Throughout the day I should be reachable and I keep myself open until 6pm. During the weekends I am unavailable unless discussed with prior.</p> | ||
<h2>Best way to communicate with me</h2> | ||
<p>I prefer to communicate with anyone through google chat or discord. For longer messages or documents please use my email. If I am working with a group on something important I prefer to be contacted over sms.</p> | ||
<h2>How do I give feedback</h2> | ||
<p>I give my feedback straight and to the point. I will try to be considerate.</p> | ||
<h2>How I prefer my feedback</h2> | ||
<p>I prefer my feed back straight to the point, if there are areas I need to improve let me know immediately.</p> | ||
<h2>Topics I like to talk about</h2> | ||
<p>I like to talk about technology, science, video games, and tv shows. If anyone has some interests they want to share with my, I would be happy to listen.</p> | ||
<h2>Goals</h2> | ||
<p>I aspire to become a Cybersecurity Professional on the Blue Team. I also want to learn new technologies to keep myself more relevant within my field. The first step in my career is to receive proper certifications such as the Security+, CySA+ , Red Hat, and PenTest+. The end goal is to be a Cloud Security Engineer or CTO if possible. I also want to set up my homelab this month to practice my skills.</p> | ||
<h2>Photos</h2> | ||
<p><img src="images/IMG_0660.jpg" height=400></p> | ||
<p><img src="images/IMG_0681.jpg" height=400></p> | ||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There needs to be more documentation and comments that explain to another engineer what this code is about and how it generally works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted, I will do more documentation next time.