Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions _test/json/unformatted.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "__foo//bar%%"
}
]
}
]
}
1 change: 1 addition & 0 deletions _test/json/unformatted.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
%%__%%foo%%//%%bar<nowiki>%%</nowiki>
20 changes: 19 additions & 1 deletion parser/TextNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,25 @@ public function getPostfixSyntax()

public function getInnerSyntax()
{
return $this->text;
if ($this->marks['unformatted']) {
return $this->text;
}
return preg_replace_callback(
"/\bhttps?:\/\/|__+|\/\/+|%%+|''+|\*\*+/",
function ($matches)
{
switch ($matches[0][0]) {
case 'h':
// We matched http(s)://
return $matches[0];
case '%':
return '<nowiki>' . $matches[0] . '</nowiki>';
default:
return '%%' . $matches[0] . '%%';
}
},
$this->text
);
}


Expand Down