App: manual - Page: fragments/markdown_2
PHP
fragments/markdown_2.php
|
HTML
fragments/markdown_2.pad
|
Result
|
<?php
$post = [ 'body' => "Written by a *visitor*: <script>alert(1)</script> and `{php:getcwd}`" ];
?>
|
{$post.body | markdown}
|
|
App: regression/framework - Page: custom/an_application_function_named_markdown_or_highlight_keeps_the_sanitize_chain
PHP
custom/an_application_function_named_markdown_or_highlight_keeps_the_sanitize_chain.php
|
HTML
custom/an_application_function_named_markdown_or_highlight_keeps_the_sanitize_chain.pad
|
Result
|
<?php
$s = "<b>x</b>";
?>
|
A[{$s | markdown}] B[{$s | highlight}] C[{$s | highlight('sql')}] D[{$s | pad:markdown}] E[{$s | upper | highlight}]
|
|
App: regression/framework - Page: escaping/a_field_piped_through_markdown_is_not_sanitized_over_its_markup
PHP
escaping/a_field_piped_through_markdown_is_not_sanitized_over_its_markup.php
|
HTML
escaping/a_field_piped_through_markdown_is_not_sanitized_over_its_markup.pad
|
Result
|
<?php $post = [ 'body' => "*Hi* & <b>" ]; ?>
|
{$post.body | markdown}
|
|
App: regression/framework - Page: escaping/markdown_escapes_a_stand_in_quote_from_a_value
PHP
escaping/markdown_escapes_a_stand_in_quote_from_a_value.php
|
HTML
escaping/markdown_escapes_a_stand_in_quote_from_a_value.pad
|
Result
|
<?php
// The markdown pipe runs on a value before it is protected, so a value from the request // may hold a quote's stand-in (U+E022); it is escaped as the quote it will be, in a link // title and in text alike, where it passed the renderer and became a live quote that // closed the title attribute the renderer built.
$b = "[a](http://x \"t\u{E022} onx=1\") and \u{E022} text";
?>
|
{echo $b | markdown}
|
|
App: regression/framework - Page: escaping/markdown_written_from_a_value_stays_text
PHP
escaping/markdown_written_from_a_value_stays_text.php
|
HTML
escaping/markdown_written_from_a_value_stays_text.pad
|
Result
|
<?php $text = "# {php:getcwd}\n\n{echo 'x'}"; ?>
|
{$text | markdown}|{markdown $text}
|
|
App: regression/framework - Page: functions/markdown_drops_a_link_whose_scheme_hides_a_control_character_reference
PHP
functions/markdown_drops_a_link_whose_scheme_hides_a_control_character_reference.php
|
HTML
functions/markdown_drops_a_link_whose_scheme_hides_a_control_character_reference.pad
|
Result
|
<?php
// A numeric reference to a control character inside the scheme: html_entity_decode leaves // 
   as they are, a browser decodes them and drops the control // character, so java script: was javascript:. A link with a reference to an ordinary // character keeps it.
$text = '[a](java script:alert(1)) [b](javascript:alert(1)) [c](java
script:alert(1)) [d](javascript:x) [ok](https://e.com/?a=1&b=2)';
?>
|
{echo $text | markdown}
|
|
App: regression/framework - Page: functions/markdown_emphasis_never_writes_crossing_tags
PHP
functions/markdown_emphasis_never_writes_crossing_tags.php
|
HTML
functions/markdown_emphasis_never_writes_crossing_tags.pad
|
Result
|
<?php
// Strong and em runs that overlap: an em pass opened inside a <strong> and closed after // it. Emphasis inside emphasis is kept.
$nested = '**foo **bar** baz**'; $crossing = '**bold *and** italic*'; $inside = '*a **b** c* and **a *b* c**';
?>
|
{$nested | markdown}|{$crossing | markdown}|{$inside | markdown}
|
|
App: regression/framework - Page: functions/markdown_escapes_an_ampersand_that_starts_no_complete_reference
PHP
functions/markdown_escapes_an_ampersand_that_starts_no_complete_reference.php
|
HTML
functions/markdown_escapes_an_ampersand_that_starts_no_complete_reference.pad
|
Result
|
<?php $text = '[a](javascript:top;alert(1))  :x; & { { ©'; ?>
|
{echo $text | markdown}
|
|
App: regression/framework - Page: functions/markdown_escapes_raw_html_and_drops_an_unsafe_link
PHP
functions/markdown_escapes_raw_html_and_drops_an_unsafe_link.php
|
HTML
functions/markdown_escapes_raw_html_and_drops_an_unsafe_link.pad
|
Result
|
<?php $text = "Hi <script>alert(1)</script> [x](javascript:alert(1)) [ok](https://example.com \"t\") and `a<b`"; ?>
|
{echo $text | markdown}
|
|
App: regression/framework - Page: functions/markdown_judges_a_link_url_and_title_with_what_was_held_inside_them
PHP
functions/markdown_judges_a_link_url_and_title_with_what_was_held_inside_them.php
|
HTML
functions/markdown_judges_a_link_url_and_title_with_what_was_held_inside_them.pad
|
Result
|
<?php $text = '[a](javascript\:alert(1)) ) [d](data\:text/html,x) [ok](https://example.com/a\_b) [t](x "<https://x/onmouseover=alert(1)//>") [u](<https://example.com/p>)'; ?>
|
{echo $text | markdown}
|
|
App: regression/framework - Page: functions/markdown_lists_take_a_tab_after_the_marker_and_an_empty_item
PHP
functions/markdown_lists_take_a_tab_after_the_marker_and_an_empty_item.php
|
HTML
functions/markdown_lists_take_a_tab_after_the_marker_and_an_empty_item.pad
|
Result
|
<?php
// Lists as editors and document exports write them - a tab after the marker - and a list // with an empty item, which is still tight.
$tabs = "-\tfoo\n-\tbar"; $number = "1.\tone\n2.\ttwo"; $empty = "- a\n-\n- c";
?>
|
{$tabs | markdown}|{$number | markdown}|{$empty | markdown}
|
|
App: regression/framework - Page: functions/markdown_of_a_value_keeps_a_text_of_indented_code
PHP
functions/markdown_of_a_value_keeps_a_text_of_indented_code.php
|
HTML
functions/markdown_of_a_value_keeps_a_text_of_indented_code.pad
|
Result
|
<?php
// A value that is all indented code - a comment, a post, a .md file.
$code = " \$a = 1;\n echo \$a;";
?>
|
{$code | markdown}|{markdown $code}| {markdown} The pair is dedented with the template around it. {/markdown}
|
|
|