mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Add superscript shorthand
As per https://web.archive.org/web/20190423095503/http://www.wikicreole.org/wiki/CreoleAdditions#section-CreoleAdditions-Superscript
This commit is contained in:
parent
6598f3860c
commit
fccbf91aa6
@ -1113,6 +1113,7 @@ class Parsedown
|
|||||||
':' => array('Url'),
|
':' => array('Url'),
|
||||||
'<' => array('UrlTag', 'EmailTag', 'Markup'),
|
'<' => array('UrlTag', 'EmailTag', 'Markup'),
|
||||||
'[' => array('Link'),
|
'[' => array('Link'),
|
||||||
|
'^' => array('Superscript'),
|
||||||
'_' => array('Emphasis'),
|
'_' => array('Emphasis'),
|
||||||
'`' => array('Code'),
|
'`' => array('Code'),
|
||||||
'~' => array('Strikethrough'),
|
'~' => array('Strikethrough'),
|
||||||
@ -1121,7 +1122,7 @@ class Parsedown
|
|||||||
|
|
||||||
# ~
|
# ~
|
||||||
|
|
||||||
protected $inlineMarkerList = '!*_&[:<`~\\';
|
protected $inlineMarkerList = '!*_&[^:<`~\\';
|
||||||
|
|
||||||
#
|
#
|
||||||
# ~
|
# ~
|
||||||
@ -1529,6 +1530,29 @@ class Parsedown
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function inlineSuperscript($Excerpt)
|
||||||
|
{
|
||||||
|
if ( ! isset($Excerpt['text'][1]))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Excerpt['text'][1] === '^' and preg_match('/^\^\^(?=\S)(.+?)(?<=\S)\^\^/', $Excerpt['text'], $matches))
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'extent' => strlen($matches[0]),
|
||||||
|
'element' => array(
|
||||||
|
'name' => 'sup',
|
||||||
|
'handler' => array(
|
||||||
|
'function' => 'lineElements',
|
||||||
|
'argument' => $matches[1],
|
||||||
|
'destination' => 'elements',
|
||||||
|
)
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function inlineUrl($Excerpt)
|
protected function inlineUrl($Excerpt)
|
||||||
{
|
{
|
||||||
if ($this->urlsLinked !== true or ! isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/')
|
if ($this->urlsLinked !== true or ! isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/')
|
||||||
@ -1961,7 +1985,7 @@ class Parsedown
|
|||||||
# Read-Only
|
# Read-Only
|
||||||
|
|
||||||
protected $specialCharacters = array(
|
protected $specialCharacters = array(
|
||||||
'\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!', '|', '~'
|
'\\', '`', '*', '_', '{', '}', '[', ']', '^', '(', ')', '>', '#', '+', '-', '.', '!', '|', '~'
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $StrongRegex = array(
|
protected $StrongRegex = array(
|
||||||
|
Loading…
Reference in New Issue
Block a user