https://github.com/tafara-n/alx-frontend-for-fun
Markdown is awesome! All your README.md are made in Markdown, but do you know how GitHub are rendering them?
https://github.com/tafara-n/alx-frontend-for-fun
html markdown python
Last synced: 6 months ago
JSON representation
Markdown is awesome! All your README.md are made in Markdown, but do you know how GitHub are rendering them?
- Host: GitHub
- URL: https://github.com/tafara-n/alx-frontend-for-fun
- Owner: Tafara-N
- Created: 2024-10-22T22:07:17.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-10-24T13:22:41.000Z (12 months ago)
- Last Synced: 2025-02-13T07:41:31.625Z (8 months ago)
- Topics: html, markdown, python
- Language: HTML
- Homepage:
- Size: 1.22 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Description
Markdown is awesome! All your README.md are made in Markdown, but do you know how GitHub are rendering them?
It’s time to code a Markdown to HTML!
# Requirements
- All your files will be interpreted/compiled on Ubuntu 18.04 LTS using `python3` (`version 3.7` or higher)
- The first line of all your files should be exactly `#!/usr/bin/python3`
- A `README.md` file, at the root of the folder of the project, is mandatory
- Your code should use the `PEP 8` style (version `1.7.*`)
- All your files must be executable
- All your modules should be documented: `python3 -c 'print(__import__("my_module").__doc__)'`
- Your code should not be executed when imported (by using `if __name__ == "__main__":`)## Tasks
### 0. Start a script
Write a script `markdown2html.py` that takes an argument 2 strings:
- First argument is the name of the Markdown file
- Second argument is the output file nameRequirements:
- If the number of arguments is less than 2: print in STDERR `Usage: ./markdown2html.py README.md README.html` and exit 1
- If the Markdown file doesn’t exist: print in STDER `Missing ` and exit 1
- Otherwise, print nothing and exit 0```bash
guillaume@vagrant:~/$ ./markdown2html.py
Usage: ./markdown2html.py README.md README.html
guillaume@vagrant:~/$ echo $?
1
guillaume@vagrant:~/$
guillaume@vagrant:~/$ ./markdown2html.py README.md README.html
Missing README.md
guillaume@vagrant:~/$ echo $?
1
guillaume@vagrant:~/$
guillaume@vagrant:~/$ echo "Test" > README.md
guillaume@vagrant:~/$ ./markdown2html.py README.md README.html
guillaume@vagrant:~/$
```**Repo:**
- GitHub repository: `alx-frontend-for-fun`
- File: `markdown2html.py`### 1. Headings
Improve `markdown2html.py` by parsing Headings Markdown syntax for generating HTML:
**Syntax:** (you can assume it will be strictly this syntax)
**Markdown** | **HTML generated**
-------------------------|-----------------------------
`# Heading level 1` | `Heading level 1
`
`## Heading level 2` | `Heading level 1
`
`### Heading level 3` | `Heading level 1
`
`#### Heading level 4` | `Heading level 1
`
`##### Heading level 5` | `Heading level 1
`
`###### Heading level 6` | `Heading level 1
````bash
guillaume@vagrant:~/$ cat README.md
# My title
## My title2
# My title3
#### My title4
### My title5guillaume@vagrant:~/$ ./markdown2html.py README.md README.html
guillaume@vagrant:~/$ cat README.htmlMy title
My title2
My title3
My title4
My title5
guillaume@vagrant:~/$
```Spacing and new lines between HTML tags don’t need to be exactly this one
**Repo:**
- GitHub repository: `alx-frontend-for-fun`
- File: `markdown2html.py`### 2. Unordered listing
Improve `markdown2html.py` by parsing Unordered listing syntax for generating HTML:
**Syntax:** (you can assume it will be strictly this syntax)
**Markdown:**
```markdown
- Hello
- Bye
```**HTML generated:**
```html
- Hello
- Bye
```
```bash
guillaume@vagrant:~/$ cat README.md
# My title
- Hello
- Bye
guillaume@vagrant:~/$ ./markdown2html.py README.md README.html
guillaume@vagrant:~/$ cat README.html
My title
- Hello
- Bye
guillaume@vagrant:~/$
```
Spacing and new lines between HTML tags don’t need to be exactly this one
**Repo:**
- GitHub repository: `alx-frontend-for-fun`
- File: `markdown2html.py`
### 3. Ordered listing
Improve `markdown2html.py` by parsing Ordered listing syntax for generating HTML:
**Syntax:** (you can assume it will be strictly this syntax)
**Markdown:**
```markdown
* Hello
* Bye
```
**HTML generated:**
```html
- Hello
- Bye
```
```bash
guillaume@vagrant:~/$ cat README.md
# My title
* Hello
* Bye
guillaume@vagrant:~/$ ./markdown2html.py README.md README.html
guillaume@vagrant:~/$ cat README.html
My title
- Hello
- Bye
guillaume@vagrant:~/$
```
Spacing and new lines between HTML tags don’t need to be exactly this one
**Repo:**
- GitHub repository: `alx-frontend-for-fun`
- File: `markdown2html.py`
### 4. Simple text
Improve `markdown2html.py` by parsing paragraph syntax for generating HTML:
**Syntax:** (you can assume it will be strictly this syntax)
**Markdown:**
```markdown
Hello
I'm a text
with 2 lines
```
**HTML generated:**
```html
Hello
I'm a text
with 2 lines
```
```bash
guillaume@vagrant:~/$ cat README.md
# My title
- Hello
- Bye
Hello
I'm a text
with 2 lines
guillaume@vagrant:~/$ ./markdown2html.py README.md README.html
guillaume@vagrant:~/$ cat README.html
My title
- Hello
- Bye
Hello
I'm a text
with 2 lines
guillaume@vagrant:~/$
```
Spacing and new lines between HTML tags don’t need to be exactly this one
**Repo:**
- GitHub repository: `alx-frontend-for-fun`
- File: `markdown2html.py`
### 5. Bold and emphasis text
Improve `markdown2html.py` by parsing bold syntax for generating HTML:
**Syntax:** (you can assume it will be strictly this syntax)
**Markdown** | **HTML generated**
-------------|-------------------
`**Hello**` | ` Hello `
`__Hello__` | ` Hello `
```bash
guillaume@vagrant:~/$ cat README.md
# My title
- He**l**lo
- Bye
Hello
I'm **a** text
with __2 lines__
**Or in bold**
guillaume@vagrant:~/$ ./markdown2html.py README.md README.html
guillaume@vagrant:~/$ cat README.html
My title
- Hello
- Bye
Hello
I'm a text
with 2 lines
Or in bold
guillaume@vagrant:~/$
```
Spacing and new lines between HTML tags don’t need to be exactly this one
**Repo:**
- GitHub repository: `alx-frontend-for-fun`
- File: `markdown2html.py`
### 6. ... but why??
Improve `markdown2html.py` by parsing bold syntax for generating HTML:
**Syntax:** (you can assume it will be strictly this syntax)
**Markdown** | **HTML generated** | **description**
--------------------|------------------------------------|---------------------------------------------------
`[[Hello]]` | `8b1a9953c4611296a827abf8c47804d7` | convert in MD5 (lowercase) the content
`((Hello Chicago))` | `Hello hiago` | remove all `c` (case insensitive) from the content
```bash
[[Hello]] 8b1a9953c4611296a827abf8c47804d7 convert in MD5 (lowercase) the content
((Hello Chicago)) Hello hiago remove all c (case insensitive) from the content
guillaume@vagrant:~/$ cat README.md
# My title
- He**l**lo
- Bye
Hello
I'm **a** text
with __2 lines__
((I will live in Caracas))
But it's [[private]]
So cool!
guillaume@vagrant:~/$ ./markdown2html.py README.md README.html
guillaume@vagrant:~/$ cat README.html
My title
- Hello
- Bye
Hello
I'm a text
with 2 lines
I will live in araas
But it's 2c17c6393771ee3048ae34d6b380c5ec
So cool!
guillaume@vagrant:~/$
```
Spacing and new lines between HTML tags don’t need to be exactly this one
**Repo:**
- GitHub repository: `alx-frontend-for-fun`
- File: `markdown2html.py`