Issue when using the footnote feature in version 0.8.0.
BLumia opened this issue · comments
I'm currently using parsedown 1.8.0-beta-1 and parsedown-extra 0.8.0 on PHP 5.4.17.
When using the footnote feature, PHP will show a notice text and tell me
Notice: Undefined index: element in Parsedown.php on line 334
. (Parsedown.php L334)
I'm not sure it's a issue of parsedown or parsedown-extra so I post it here...
How to reproduce the issue:
<?php
require_once('./Parsedown.php');
require_once('./ParsedownExtra.php');
$ParsedownExtra = new ParsedownExtra();
echo $ParsedownExtra->text(
"test footnote marker[^1]. test footnote marker two[^2]. \n".
"[^1]: test marker text\n".
"[^2]: test marker text two"
);
It seems when we call extractElement()
at line L267 and L319, the argument doesn't have the 'element' index, hope this info helps.
Any news on this? I get the same error @aidantwoods
protected function extractElement(array $Component)
{
if ( ! isset($Component['element']) and isset($Component['markup']))
{
$Component['element'] = array('rawHtml' => $Component['markup']);
}
return $Component['element'];
}
The following code:
$parsedownExtra->text('Parsedown Extra [^1]'.PHP_EOL.'[^1]: http://parsedown.org/extra/');
Returns the following data (Laravel error handler):
array:1 [
"Component" => array:6 [
"label" => "1"
"text" => "http://parsedown.org/extra/"
"hidden" => true
"type" => "Footnote"
"identified" => true
"continuable" => true
]
]
Neither element
or the markup
are present in the array, so the condition in Parsedown::extractElement()
is never met.
This was an oversight on my part, and should be resolved when using Parsedown 1.8.0-beta-4 with ParsedownExtra 0.8.0-beta-1.
I'm currently using [...] parsedown-extra 0.8.0
I should mention that ParsedownExtra 0.8.0 wasn't released yet, the number was only set like that in master (which is a development branch) because the release is upcoming :)
That was fast! It's working again using the latest beta.
Thanks for your hard work @aidantwoods