simov / markdown-viewer

Markdown Viewer / Browser Extension
MIT License
1.08k stars 135 forks source link

Add CSS & HTML Support #148

Closed oldaccofpronoy2108 closed 3 years ago

oldaccofpronoy2108 commented 3 years ago

Please add HTML & CSS support as it would allow users to integrate CSS & HTML into their Markdown files....

jerrygreen commented 3 years ago

It is already possible. You can put, for example:

# This is my markdown file

<style>
img {
  padding: 24px;
  border: 1px solid gray;
}
</style>

## Subtitle

Some description, etc...

![image](...)
oldaccofpronoy2108 commented 3 years ago

That was CSS, but what about HTML?

jerrygreen commented 3 years ago

@pronoymukherjeewritescode don’t you see style tag? The same way you can use whatever else tags: div, img, video, iframe, etc

oldaccofpronoy2108 commented 3 years ago

markbug

It isn't working... Markdown viewer keeps showing HTML & CSS elements as text...which is bad...

jerrygreen commented 3 years ago

@pronoymukherjeewritescode paste entire text/code of the file into here pls

oldaccofpronoy2108 commented 3 years ago

@pronoymukherjeewritescode paste entire text/code of the file into here pls

I copied the code you gave here:

# This is my markdown file

<style>
img {
  padding: 24px;
  border: 1px solid gray;
}
</style>

## Subtitle

Some description, etc...

![image](...)
jerrygreen commented 3 years ago

@pronoymukherjeewritescode this is weird. Because what I see is:

image

oldaccofpronoy2108 commented 3 years ago

Did you use the same code for this?

simov commented 3 years ago

@pronoymukherjeewritescode you have to disable the sanitize option.

oldaccofpronoy2108 commented 3 years ago

Code I used:

| Before | After |
| ----------- | ----------- |
| ```
<table>
<thead>
<tr>
<th>Before</th>
<th>After</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>
```      |   <table> <thead> <tr> <th>Before</th> <th>After</th> </tr> </thead> <tbody> <tr> <td></td> <td></td> </tr> </tbody> </table>    |

Output: marktable

Thanks @simov, it worked, now I can use HTML & CSS!!!!