From 6b6118e9e8d69c8c9226877a3494a62f09891a56 Mon Sep 17 00:00:00 2001
From: Thomas Casteleyn #i', '# Strong Text Strong Text Strong Text
', '
', '
'), "\n" ),
- array( array('', '
'), array('*', '*') ),
- array( array('', '
'), array('*', '*') ),
- array( array('', '
'), array('*', '*') ),
- array( array('', ''), array('*', '*') ),
- array( array('', ''), array('*', '*') ),
- array( array('', ''), array('_', '_') ),
- array( array('', ''), array('_', '_') ),
- array( array('', ''), array('~', '~') ),
- array( array('', ''), array('~', '~') ),
- array( array('', ''), array('`', '`') ),
- array( array('', '
'), array('```', '```') ),
+ [ '#
#i', "\n" ],
+ [ ['#(
#i'], ['```', "```\n"] ],
+ [ ['#<(mark[^>]*|code)>#i', '#(mark|code)>#i'], '`' ],
);
// Replace HTML tags (list must contain at least tags from the $aReplacementsMatrix)
- $sContent = strip_tags($sContent, ']*>)?#i', '#()?');
+ $sContent = strip_tags($sContent, '
');
foreach($aReplacementsMatrix as $aReplacements)
{
- $sContent = str_replace($aReplacements[0], $aReplacements[1], $sContent);
+ $sContent = preg_replace($aReplacements[0], $aReplacements[1], $sContent);
}
// Replace hyperlinks
From 51b422d75313e00f1b8d8b5d0736bd03984508a3 Mon Sep 17 00:00:00 2001
From: jf-cbd Heading 2
Heading 3
Bold Text
Emphasized Text
Italic TextDeleted TextStrikethrough Text
Inline Code
Block of Code\r\nLine 1\r\nLine 2\r\n
+HTML,
+ "expected" => "*Heading 1*\n*Heading 2*\n*Heading 3*\n*Strong Text*\n*Bold Text*\n_Emphasized Text_\n_Italic Text_\n~Deleted Text~\n~Strikethrough Text~\n \n• List Item 1\n• List Item 2\n`Inline Code`\n \n```Block of Code\r\nLine 1\r\nLine 2\r\n```\n",
+ ],
];
}
}
From 6c69df1b61dcd4c615fc8686d49a12f4534f6cf2 Mon Sep 17 00:00:00 2001
From: Thomas Casteleyn Heading 2
Heading 3
Bold Text
Emphasized Text
Italic TextDeleted TextStrikethrough Text
Inline Code
Block of Code\r\nLine 1\r\nLine 2\r\n
+Heading 1
Heading 2
Heading 3
Bold Text
Emphasized Text
Italic TextDeleted TextStrikethrough Text
Marked TextInline Code
HTML,
- "expected" => "*Heading 1*\n*Heading 2*\n*Heading 3*\n*Strong Text*\n*Bold Text*\n_Emphasized Text_\n_Italic Text_\n~Deleted Text~\n~Strikethrough Text~\n \n• List Item 1\n• List Item 2\n`Inline Code`\n \n```Block of Code\r\nLine 1\r\nLine 2\r\n```\n",
+ "expected" => "*Heading 1*\n*Heading 2*\n*Heading 3*\n*Strong Text*\n*Bold Text*\n_Emphasized Text_\n_Italic Text_\n~Deleted Text~\n~Strikethrough Text~\n`Marked Text`\n`Inline Code`\n• List Item 1\n• List Item 2\n```Block of Code\r\nLine 1\r\nLine 2\r\n```\n",
],
];
}
From 4c19b00a00c6efde35f48bf566c02f6eb7fe5a37 Mon Sep 17 00:00:00 2001
From: Thomas Casteleyn Block of Code\r\nLine 1\r\nLine 2\r\n
hi
+HTML, + "expected" => "hello\nhi\n", + ], + "Different tags on different lines" => [ + "input" => <<hellohi
+HTML, + "expected" => "*hello*\n*hi*\n", + ], + "Nested tags" => [ + "input" => <<I'm bold andI'm bold and italic
+HTML, + "expected" => "*I'm bold and*\n_*I'm bold and italic*_\n", + ], "Large text with different tags" => [ "input" => <<Heading 1Strong Text
Bold Text
Emphasized Text
Italic TextDeleted TextStrikethrough Text
Marked TextInline Code
Block of Code\r\nLine 1\r\nLine 2\r\n
HTML,
"expected" => "*Heading 1*\n*Heading 2*\n*Heading 3*\n*Strong Text*\n*Bold Text*\n_Emphasized Text_\n_Italic Text_\n~Deleted Text~\n~Strikethrough Text~\n`Marked Text`\n`Inline Code`\n• List Item 1\n• List Item 2\n```Block of Code\r\nLine 1\r\nLine 2\r\n```\n",
- ],
+ ],
];
}
}