Skip to content

Commit d563603

Browse files
authored
Merge branch 'code-differently:main' into feat-ethanhilman/lesson04
2 parents aa78b67 + ac05dac commit d563603

File tree

214 files changed

+31318
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+31318
-13
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Check Lesson 05 Quiz Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
paths:
7+
- "lesson_05/quiz/**"
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Use Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20.x'
23+
24+
- name: Build Shared Lib with Node.js
25+
working-directory: ./lib/javascript/codedifferently-instructional
26+
run: npm ci
27+
28+
- name: Build Lesson 05 Quiz with Node.js
29+
working-directory: ./lesson_05/quiz
30+
run: |
31+
npm ci
32+
npm run check

lesson_01/tyranricejr/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# 📝 Markdown To HTML Script
2+
3+
This program turns any Markdown file into a complete HTML document.
4+
5+
#### _Created By: Tyran Rice Jr._
6+
7+
## 📖 How It Works
8+
9+
### 1. Start with a Markdown file
10+
Markdown is plain text with some symbols for formatting
11+
12+
### 2. Read the file
13+
The script uses Pythons `open()` in-built function to read the Markdown file:
14+
```py
15+
with open(markdown_path, "r", encoding="utf-8") as md_file:
16+
```
17+
### 3. Update References
18+
When reading the markdown file, the source functions for images are not pathed properly,
19+
so we must update them:
20+
21+
### 4. Convert Markdown → HTML
22+
We then use the [`markdown`](https://pypi.org/project/Markdown/) library to turn Markdown into HTML:
23+
```py
24+
html_content = markdown.markdown(markdown_content)
25+
```
26+
27+
### 5. Wrap HTML document in a complete page
28+
We wrap the entire converted markdown file in HTML tags listed below:
29+
- `<!DOCTYPE html>` and `<html>` / `<head>` tags
30+
- A `<link>` to **GitHub's** CSS Markdown Stylesheet
31+
- Small custom CSS for width, margin and padding
32+
33+
### 6. Write to `convertedmarkdown.html`
34+
We save the wrapped HTML page:
35+
```py
36+
with open("./convertedmarkdown.html", "w") as f:
37+
```
38+
We can then see the HTML file in the same folder as `markdownparser.py`.
39+
40+
## 🚀 How to Use
41+
42+
### 1. Install `markdown`:
43+
```bash
44+
pip install Markdown
45+
```
46+
### 2. Navigate To Folder
47+
Starting from the root directory, navigate to
48+
`lesson_01/tyranricejr`. This is where the script is located in.
49+
50+
### 3. Run the script:
51+
```bash
52+
python markdownparser.py
53+
```
54+
55+
### 4. Input your `markdown` file path:
56+
The script will ask you to input your `markdown` file path. This path should be the direct path starting either from the `root` directory or from `lesson_01/tyranricejr` directory.
57+
58+
### 5. Success!
59+
After putting your correct file path, the script
60+
will give you the `HTML` converted version in the output file!
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
import markdown
2+
3+
'''
4+
5+
Title: Markdown Parser
6+
7+
Description: This program turns your Markdown files into HTML files
8+
9+
Created By: Tyran Rice Jr.
10+
11+
'''
12+
13+
'''
14+
15+
Function Title: read_markdown_file
16+
17+
Description:
18+
This function reads the user's markdown file from the
19+
given path input.
20+
21+
Arguments:
22+
- markdown_path: The path to the Markdown file given by the user
23+
24+
Returns:
25+
- markdown_content: The Markdown file that was read from the given path
26+
27+
'''
28+
29+
30+
def read_markdown_file(markdown_path):
31+
with open(markdown_path, "r", encoding="utf-8") as md_file:
32+
markdown_content = md_file.readlines()
33+
34+
return markdown_content
35+
36+
37+
'''
38+
39+
Function Title: write_html_file
40+
41+
Description:
42+
This function takes the user's updated markdown file and converts it
43+
into a HTML file under the name 'convertedmarkdown.html'.
44+
45+
Arguments:
46+
- markdown_content: The updated Markdown file
47+
48+
Returns:
49+
- void: Simply writes a new HTML file
50+
51+
'''
52+
53+
54+
def write_html_file(markdown_content):
55+
# Convert Markdown file to HTML
56+
html_content = markdown.markdown(markdown_content)
57+
58+
with open("./output/convertedmarkdown.html", "w") as f:
59+
f.write("<!DOCTYPE html>\n")
60+
f.write("<html lang='en'>\n")
61+
f.write("""<head>
62+
<meta charset = "UTF-8" >
63+
<link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.2.0/github-markdown-light.min.css" >
64+
<style >
65+
body {
66+
max-width: 800px;
67+
margin: auto;
68+
padding: 2rem;
69+
}
70+
</style >
71+
</head >
72+
<body class = "markdown-body" >""")
73+
f.write(html_content + "\n")
74+
f.write("</html>")
75+
76+
77+
'''
78+
79+
Function Title: change_url_path
80+
81+
Description:
82+
This function changes the URL path for src references to
83+
make sure they are correctly pathed to the right directory.
84+
This is done by taking the input of the user's path to their
85+
existing mark down file and adding it to the src path.
86+
87+
Arguments:
88+
- markdown_content: The Markdown file given by the user
89+
- markdown_path: The path to the Markdown file given by the user
90+
91+
Returns:
92+
- markdown_content: The new Markdown file with updated src paths
93+
94+
'''
95+
96+
97+
def change_url_path(markdown_content, markdown_path):
98+
# Removes 'README.md' from path to ensure the path is correctly referenced in src
99+
markdown_path = markdown_path.removesuffix("README.md")
100+
for i in range(len(markdown_content)):
101+
# If "src=" is located in a line, it will be correctly referenced
102+
if (markdown_content[i].find("src=") != -1):
103+
index = markdown_content[i].find("src=")
104+
# Change src to have the correct path location
105+
markdown_content[i] = markdown_content[i][:index + 4] + \
106+
"\"" + markdown_path + markdown_content[i][index + 5:]
107+
108+
return markdown_content
109+
110+
111+
def main():
112+
try:
113+
print("Welcome to Tyran's Markdown-To-HTML Converter")
114+
markdown_path = input("Please enter the path of the mark down file: ")
115+
116+
# Read the Markdown file and convert it into a list of strings
117+
markdown_content = read_markdown_file(markdown_path)
118+
119+
# Update references inside Markdown file
120+
markdown_content = change_url_path(markdown_content, markdown_path)
121+
122+
# Join the list of strings from the Markdown file into one entire string
123+
markdown_content = ''.join(markdown_content)
124+
125+
# Turn the Markdown file into a HTML file
126+
write_html_file(markdown_content)
127+
128+
print("Converted Markdown To HTML content")
129+
130+
except FileNotFoundError:
131+
print("Error: The specified Markdown file was not found.")
132+
except Exception as e:
133+
print(f"An error occurred!\nError: {e}")
134+
135+
136+
if __name__ == "__main__":
137+
main()
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!DOCTYPE html>
2+
<html lang='en'>
3+
<head>
4+
<meta charset = "UTF-8" >
5+
<link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.2.0/github-markdown-light.min.css" >
6+
<style >
7+
body {
8+
max-width: 800px;
9+
margin: auto;
10+
padding: 2rem;
11+
}
12+
</style >
13+
</head >
14+
<body class = "markdown-body" ><h1>📝 Markdown To HTML Script</h1>
15+
<p>This program turns any Markdown file into a complete HTML document.</p>
16+
<h4><em>Created By: Tyran Rice Jr.</em></h4>
17+
<h2>📖 How It Works</h2>
18+
<h3>1. Start with a Markdown file</h3>
19+
<p>Markdown is plain text with some symbols for formatting</p>
20+
<h3>2. Read the file</h3>
21+
<p>The script uses Pythons <code>open()</code> in-built function to read the Markdown file:
22+
<code>py
23+
with open(markdown_path, "r", encoding="utf-8") as md_file:</code></p>
24+
<h3>3. Update References</h3>
25+
<p>When reading the markdown file, the source functions for images are not pathed properly,
26+
so we must update them:</p>
27+
<h3>4. Convert Markdown → HTML</h3>
28+
<p>We then use the <a href="https://pypi.org/project/Markdown/"><code>markdown</code></a> library to turn Markdown into HTML:
29+
<code>py
30+
html_content = markdown.markdown(markdown_content)</code></p>
31+
<h3>5. Wrap HTML document in a complete page</h3>
32+
<p>We wrap the entire converted markdown file in HTML tags listed below:
33+
- <code>&lt;!DOCTYPE html&gt;</code> and <code>&lt;html&gt;</code> / <code>&lt;head&gt;</code> tags
34+
- A <code>&lt;link&gt;</code> to <strong>GitHub's</strong> CSS Markdown Stylesheet
35+
- Small custom CSS for width, margin and padding</p>
36+
<h3>6. Write to <code>convertedmarkdown.html</code></h3>
37+
<p>We save the wrapped HTML page:
38+
<code>py
39+
with open("./convertedmarkdown.html", "w") as f:</code>
40+
We can then see the HTML file in the same folder as <code>markdownparser.py</code>.</p>
41+
<h2>🚀 How to Use</h2>
42+
<h3>1. Install <code>markdown</code>:</h3>
43+
<p><code>bash
44+
pip install Markdown</code></p>
45+
<h3>2. Navigate To Folder</h3>
46+
<p>Starting from the root directory, navigate to
47+
<code>lesson_01/tyranricejr</code>. This is where the script is located in.</p>
48+
<h3>3. Run the script:</h3>
49+
<p><code>bash
50+
python markdownparser.py</code></p>
51+
<h3>4. Input your <code>markdown</code> file path:</h3>
52+
<p>The script will ask you to input your <code>markdown</code> file path. This path should be the direct path starting either from the <code>root</code> directory or from <code>lesson_01/tyranricejr</code> directory.</p>
53+
<h3>5. Success!</h3>
54+
<p>After putting your correct file path, the script
55+
will give you the <code>HTML</code> converted version in the output file!</p>
56+
</html>

lesson_03/quiz/quiz.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,54 @@
11
quiz:
22
answers:
3+
devynbenson:
4+
- $2y$10$sWKccZ3ayEvVSAKCRw5sQOkQsEJK97s1oPrhISEjdNgbd/XLQAu8a
5+
- $2y$10$wf66v6SXDp5Xg4WzYqFbx.MlKTBPARrJzqe63ab04Y6KaQf89nBuq
6+
- $2y$10$PJFq7P3tjX/qKT24YrzALeh4I/YQkBG.TBDPCAkkv2QlP1B55tFse
7+
- $2y$10$XHWsHjk0xK8biSZg7PdbNuq9eTl2avpRW4SREzkfLkTHums.P9s2G
8+
- $2y$10$LArQeWWDxFYuhNh1qOsid.dnAjCxzNXo9HVa2cMXszBMNMgJW.RDq
9+
- $2y$10$T4MnX8ziY73qQTQGoVASKe.X86SW/aO0uHcq5FjF1EqBfPM2H5YSC
10+
- $2y$10$kKpASEQjfI561W9KwagMse4vkCUTam2RL11/lbWcLGy07DjLJ8UAC
11+
- $2y$10$5KNllKrKykFg5BMMq4e0v.5wYVoBnJfPquc1yejWNyT1hLF.K0n46
12+
- $2y$10$wfUOFkQbjHL/j5ozsSE3MurP966.uCsTF03SeWw2EH4ukGDEqvNXe
13+
- $2y$10$J/UxnMY4pUQyRgnCTPolWeuMi0.CNUB6MG6UUL6f0lTdLn2..OF7q
314
anthonymays:
415
- $2y$10$8eHSzy3aCu4Ry3LzO9nWCeGpofSxsNVbnF.wCfn3ZADwQ6MEtN/KK
516
- $2y$10$55EXRjF26JIgebtoH800ZOJecfefvMgHicuxf/rwTENuxiUaFQcNe
617
anotherone:
718
- $2y$10$8eHSzy3aCu4Ry3LzO9nWCeGpofSxsNVbnF.wCfn3ZADwQ6MEtN/KK
819
- $2y$10$dGB0CGv7.XQC5OqfyY6iXOiJsdVyxU3ve5YE0gt4m2I8P8H13lNXa
20+
joybrown:
21+
- $2y$10$yTiBtEBryEjrDBCr2oMgM.ZK5brflCLeA6jrUeYFMp2Chy8wMYTQS
22+
- $2y$10$6v2jhMmq59J50eApiMlPaufiq8piTl8fWxVkZba8OayMSVtcp1XPG
23+
- $2y$10$PAhEzyzGbbr0G9GmPTcKLueZUSjn5bccbPZKYJWinvlW.FHnRtdeq
24+
calvinrobinson:
25+
- $2y$10$cq2na3OgOfB0rpCum0vwA./4zXbQ2xZT5avpyfmpp9e0LDtU5eJu.
26+
- $2y$10$yog14Y5aV9U3lPv3s9FhaORRwg9rRslGdnBt8Px8ASQWtxUjgwHpS
27+
- $2y$10$k5rLqfcOEJy/T3E5MRczRuvIIfjeefiuDp02nSN2o7j2BUoD48nb2
28+
jarededge:
29+
- $2y$10$Kx2BYkI5IAFavfXUwN/ST.lJIuajCNlxjO5hLuvKar1Pu4CkBxNwW
30+
- $2y$10$qidseGsgyENF1SHAzQ.Kn.mJgwSaT1cqGeMohqUuOsiViiU5lmWvi
31+
- $2y$10$uU3/atiXzJAHlXr4GD5.a.bOSNVFyH0MQNDQ9tkh/hUAms/4gIi9W
32+
danielboyce:
33+
- $2y$10$3sE7jqrvoniwvAR7Hb94aOkqvWtRMX/rLARy4q8B2xJ4JVifK3BLC
34+
- $2y$10$ONEdMxmf7aUg.1p/PGhAfOIaRyNoFepaoRqpCnR//JLdJETXNKuzK
35+
- $2y$10$.mzip.DvXRpm0CU3T6nQOuiq82J1HnWnBc.uMLfAEPZp76Y6mB5Ei
36+
marthao:
37+
- $2y$10$y6amHaLPanQnyIaLHfQVo.NLAVnsulCLZYc3OcXj2uJZW4zCwFpc2
38+
- $2y$10$6iYhNOcXHY/Ihf9FdYjulu.rXISSkk3sqWLCDCbybNsWVfoU6sa4q
39+
- $2y$10$IA6MNfZp8mQoVm2P.BYA.efvtgL0Y6ad0VdQ8H8LYhTUcMFXR0JFK
40+
nicolejackson:
41+
- $2y$10$eRdxpAR2N0ELMjdQ0DGzlOc8Lx5EhhwcddRJ3qPjit9nH9fwORhg.
42+
- $2y$10$eRdxpAR2N0ELMjdQ0DGzlOc8Lx5EhhwcddRJ3qPjit9nH9fwORhg.
43+
- $2y$10$eRdxpAR2N0ELMjdQ0DGzlOc8Lx5EhhwcddRJ3qPjit9nH9fwORhg.
44+
mattieweathersby:
45+
- $2y$10$WxUCKALSc8EWp1uj26U./exKFNnV5yUtnP04IK.dX/G0A5QB94qXS
46+
- $2y$10$WxUCKALSc8EWp1uj26U./exKFNnV5yUtnP04IK.dX/G0A5QB94qXS
47+
- $2y$10$pd30wieyG01lxyn/o/huU.XTdawk1nfKKPYE7mdX7aWS/CaOA1o1a
48+
kerryferguson:
49+
- $2y$10$rQOC2ou8kj7O7haspQdoVOgn9nJnNeQqx.bl3JS8FugfT3.gr0cby
50+
- $2y$10$1rKN/68YNsCHyFbIYN5mAOKsmA2L.0IjmoSlHyYsLSabPBTEmQlua
51+
- $2y$10$cesMJeZzsIIh1JqoLmwWh.PtMWXAgJjJuIX0LZJOVWIZxzEna3WzK
952
danielsonadjocy:
1053
- $2y$13$a2VPLkXi0XoTkCgytHabiuFX36ezOtQvSgG8Fjonlp.FYsgDnMQ1S
1154
- $2y$10$z37Nf6Ay1CZrbb3OtmhaXuFGnOqiUgAEc6CThl3iUAVFE3kEYS/cq
@@ -27,3 +70,24 @@ quiz:
2770
- $2y$10$FMRsdjEhIG0anbZOIcVvSOy4e4eFTZGIYYyATChwc.QRMpWuomR5C
2871
- $2y$10$0AQW/94c4pPxp8xIhJUIs.qoLnUuQg/Hwe1vd4975K96EKGEPz.H6
2972
- $2y$10$ibNpd6ZjWh/yRXafaN8R5.vxbBw7KVZ7r4IsFv4Uy3naXqagr2B5W
73+
jaizel_quiz:
74+
- $2y$10$l0gz8cPuUAV/fPCz1eZPLuceO/ea4VzwVY2e4VkjWjkjMh785XOaa
75+
- $2y$10$ESuiNYZk3LoPpwXWWI9HuOAW1UkMXvihaXb1FbOgMyUzmxD1EmcUe
76+
- $2y$10$pwNF2IjXoEXS7VnuiQI23O3/i4AmT7e5KUYTrtm3ewJdb.vFpNxTy
77+
evanderblue:
78+
- $2y$10$jrzJya6WaaYok/vLLHxkSuZR/DxlaKZwFfbLZ0ecoVLL2Xh6yjyDq
79+
- $2y$10$Z1ZuoK050bRTVDb3X/xkcuw1pGQvKGkhoLVqmVABTTOwcJPjsIOG6
80+
- $2y$10$t3aHn3NxL/fP0n8w2yHm4OnLNF2ZYEztm.Avwgo2vleOkfRWKdRSa
81+
lindaquinoa:
82+
- $2y$10$c.9r1fNSkCuBu6TBI53vfet82OkufPL4mkFZsocIFpz3dQQoYkL9K
83+
- $2y$10$5.x9AKn2gEhew5ek1Y7GguN/bvae2EktevTDpCBvuEjqqOy/MeuHK
84+
- $2y$10$sW6nyRbtgsBgwypTO4s/6.q4YxcHmTSOW62AzXxr5OWd0M6luF2C.
85+
taliacrockett:
86+
- $2y$10$Q/lb7miLQrsy9D5j/4FE/.DZAzQ4BkIWk8BUKjjaIg2OLRS9v1/cC
87+
- $2y$10$MWsUIECL5NP2p/8RbbDWv.Mi6shrjwRtHFMwd/zpmKuCNVSAZXd/e
88+
- $2y$10$VjopdAwacAcQ718VRrjNJOLHVQ1oTql58p.wfpo3P4jYOkHQAL88W
89+
dean_walston_25_2:
90+
- $2y$10$avH4Adz6z900VAKHK3p0bunDaJBPPckhVzdJ1XWbp/oK3myHl8LMC
91+
- $2y$10$YTgMZYzNVpbjywYu2DvyZOHjtIIjyFj1gyjI5sGLPxjl91s7FHRGO
92+
- $2y$10$xlWI1a5RHpIzgCE65ys5wue6935c9mqH3AKbRfq6ZC7xz5QSsBmYS
93+
- $2y$10$zr1Do5BFxa6Ts6wCd3i9cOeDiJWHK1tY4QbAspwXdVUcrYllLl1vG

0 commit comments

Comments
 (0)