An open API service indexing awesome lists of open source software.

https://github.com/shannon-kioko/alx-frontend-for-fun


https://github.com/shannon-kioko/alx-frontend-for-fun

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

# alx-frontend-for-fun

## Markdown to HTML

### 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 name
Requirements:

- 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:~/$
```

### 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 title5

guillaume@vagrant:~/$ ./markdown2html.py README.md README.html
guillaume@vagrant:~/$ cat README.html

My 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

### 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:
```Bash
- Hello
- Bye
```
HTML generated:
```


  • Hello

  • Bye


```
```
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

### 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:
```
* Hello
* Bye
```
HTML generated:
```


  1. Hello

  2. 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



  1. Hello

  2. Bye


guillaume@vagrant:~/$
```
Spacing and new lines between HTML tags don’t need to be exactly this one

### 4. Simple text
#advanced
Improve markdown2html.py by parsing paragraph syntax for generating HTML:

Syntax: (you can assume it will be strictly this syntax)

Markdown:

Hello

I'm a text
with 2 lines
HTML generated:


Hello



I'm a text


with 2 lines


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

### 5. Bold and emphasis text
#advanced
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
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

### 6. ... but why??
#advanced
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
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