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

https://github.com/manufosela/rich-markdown-to-html

Library to convert Rich Mark Down (color and background images) into HTML code
https://github.com/manufosela/rich-markdown-to-html

Last synced: 3 months ago
JSON representation

Library to convert Rich Mark Down (color and background images) into HTML code

Awesome Lists containing this project

README

        

# Rich MarkDown To HTML

Use heading titles, strong, italic and strong-italic text to add color

## Conventions from Rich MarkDown

```
# Heading level 1 ->

Heading level 1


# |#F93|Heading level 1 ->

Heading level 1


## Heading level 2 ->

Heading level 2


## |#F93|Heading level 2 ->

Heading level 2


### Heading level 3 ->

Heading level 3


### |#F93|Heading level 3 ->

Heading level 3


#### Heading level 4 ->

Heading level 4


#### |#F93|Heading level 4 ->

Heading level 4

**strong text** -> strong text
**|2BD|strong text** -> strong text
**|_/img/linea.png_|texto negrita* -> texto negrita
**|2BD||_/img/linea.png_|img negrita** -> texto negrita

*italic text* -> italic text
*|3FA|italic text* -> italic text

***strong and italic text*** -> strong text
***|green|strong and italic text*** -> strong text

··texto subrayado·· -> texto subrayado
··|_/img/linea.png_| texto subrayado·· -> texto subrayado
```

## Regular expressions:

### Headings
```
^#\s(.*)
^##\s(.*)
^###\s(.*)
^####\s(.*)
^#####\s(.*)
^######\s(.*)
```

### italica *
```
[^*]\*([^\*].*?)\*
```

### Negrita **
```
[^*]\*\*([^\*].*?)\*\*
```

### negrita e italica ***
```
[^*]\*\*\*(.*?)\*\*\*
```

### subrayado ··
```
[^·]··(.*?)··
```

### color |...|
```
\|([\(\)\w#]*)\|(.*)
```

### imagen |_..._|
```
\|_([\/\w\.]*)_\|(.*?)
```

## DEMO

```
import pkg from 'rich-markdown-to-html';
const { parseRMD} = pkg;

const result = parseRMD(`
**|orange|hola** pepito lopez
*Cómo estás*
***negrita y cursiva***
# |rgba(255, 255, 0, 0.5)|titulo 1
## titulo 2
### titulo 3
#### titulo 4
##### |blue|titulo 5
###### titulo 6
**|2BD||_/img/linea.png_|img negrita**
otro texto sin importancia pero esta ··palabra·· va **|_https://png.pngtree.com/element_our/20200609/ourmid/pngtree-purple-underline-image_2231184.jpg_|subrayada**
No se que mas poner
`);
console.log(result);
```