Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ca6ecc
commit e447442
Showing
4 changed files
with
99 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
title: 'HTML Blocks' | ||
--- | ||
|
||
## JSX (with no HTML attributes) | ||
|
||
<HTMLBlock runScripts={true}> | ||
<script>console.log(true, 0);</script> | ||
<h3>Header 0</h3> | ||
<p>Paragraph with <em>italics</em> and <strong>bold stuff</strong>.</p> | ||
<div>I am actually a div!</div> | ||
</HTMLBlock> | ||
|
||
|
||
## JSX | ||
|
||
<HTMLBlock> | ||
<script>console.log(true, 1);</script> | ||
<h3>Header 1</h3> | ||
<p>Paragraph with <em>italics</em> and <strong>bold stuff</strong>.</p> | ||
<div style={{ paddingLeft: "20px", color: "blue" }}> | ||
Behold, I am blue and indented! | ||
</div> | ||
</HTMLBlock> | ||
|
||
|
||
## HTML as a prop | ||
|
||
<HTMLBlock children='<script>console.log(true, 2);</script><h3>Header 2</h3> | ||
<p>Paragraph with <em>italics</em> and <strong>bold stuff</strong>.</p> | ||
<div style="padding-left: 20px; color: blue">Behold, I am blue and indented!</div>' /> | ||
|
||
|
||
## HTML in template literal | ||
|
||
<HTMLBlock> | ||
{` | ||
<script>console.log(true, 3);</script> | ||
<h3>Header 3</h3> | ||
<p>Paragraph with <em>italics</em> and <strong>bold stuff</strong>.</p> | ||
<div style="padding-left: 20px; color: blue"> | ||
Behold, I am blue and indented! | ||
</div> | ||
`} | ||
</HTMLBlock> | ||
|
||
|
||
## JSX in safe mode | ||
|
||
<HTMLBlock safeMode={true}> | ||
<script>console.log(true, 4);</script> | ||
<h3>Header 4</h3> | ||
<p>Paragraph with <em>italics</em> and <strong>bold stuff</strong>.</p> | ||
<div style={{ paddingLeft: "20px", color: "blue" }}> | ||
Behold, I am blue and indented! | ||
</div> | ||
</HTMLBlock> | ||
|
||
|
||
## HTML in safe mode | ||
|
||
<HTMLBlock safeMode={true}> | ||
{` | ||
<script>console.log(true, 5);</script> | ||
<h3>Header 5</h3> | ||
<p>Paragraph with <em>italics</em> and <strong>bold stuff</strong>.</p> | ||
<div style="padding-left: 20px; color: blue"> | ||
Behold, I am blue and indented! | ||
</div> | ||
`} | ||
</HTMLBlock> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
|
||
## Sanitizing `style` tags | ||
|
||
<style> | ||
* { | ||
background-color: olive; | ||
} | ||
</style> | ||
|
||
|
||
## Sanitizing `style` attributes | ||
|
||
<p style="background-color: salmon">fish content</p> | ||
|
||
|
||
## Sanitizing html blocks | ||
|
||
<HTMLBlock> | ||
<h2>Header</h2> | ||
<p>hello there</p> | ||
</HTMLBlock> | ||
[block:html] | ||
{ | ||
"html": "<style>* { border: 3px solid magenta; }</style>" | ||
} | ||
[/block] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters