Open TheWiseMan opened 6 months ago
(just updated to 1.2.7, this issue didn't exist in 1.2.3)
Interesting, I take a look
how does your setting look like?
$Parser->setSetting('math', [
'inline' => [
'delimiters' => [
//['left' => '\\(', 'right' => '\\)'],
['left' => '$', 'right' => '$'],
],
"enabled" => true
],
'block' => [
'delimiters' => [
['left' => '$$', 'right' => '$$'],
['left' => '\\begin{equation}', 'right' => '\\end{equation}'],
['left' => '\\begin{align}', 'right' => '\\end{align}'],
['left' => '\\begin{alignat}', 'right' => '\\end{alignat}'],
['left' => '\\begin{gather}', 'right' => '\\end{gather}'],
['left' => '\\begin{CD}', 'right' => '\\end{CD}'],
['left' => '\\[', 'right' => '\\]'],
],
"enabled" => true
],
"enabled" => true
]);
$Parser->setSetting('diagrams', true);
$Parser->setSetting('typographer', false);
$Parser->setSetting('emphasis', [
'bold' => true, // Enable bold emphasis
'italic' => true, // Enable italic emphasis,
"subscript" => false,
"superscript" => true,
// Specify other emphasis styles as needed
]);
$Parser->setSetting('smarty', [
'substitutions' => [
'left-double-quote' => '"', // Double bottom quote
'right-double-quote' => '"', // Double top quote
"ndash"=> '–',
"mdash" =>'—',
"left-single-quote" => "'",
"right-single-quote" => "'",
"left-angle-quote" => '«',
"right-angle-quote" => '»',
"ellipses"=> "..."
],
"enabled" => true
]);
It looks like it does not remove newlines, but math destroys the formatting blocks it's in.
Hmmm can't seem to replicate it. I know that ParsedownExtra has a issue with definitions lists there can break the formatting for all other elements if not 100% correctly typed, but don't know if you have that in your markdown
Also you could use setSettings
so you don't need to specify every setting separately
$Parser->setSettings([
'math' => [
'inline' => [
'delimiters' => [
//['left' => '\\(', 'right' => '\\)'],
['left' => '$', 'right' => '$'],
],
],
'block' => [
'delimiters' => [
['left' => '$$', 'right' => '$$'],
['left' => '\\begin{equation}', 'right' => '\\end{equation}'],
['left' => '\\begin{align}', 'right' => '\\end{align}'],
['left' => '\\begin{alignat}', 'right' => '\\end{alignat}'],
['left' => '\\begin{gather}', 'right' => '\\end{gather}'],
['left' => '\\begin{CD}', 'right' => '\\end{CD}'],
['left' => '\\[', 'right' => '\\]'],
],
],
],
'diagrams' => true,
'typographer' => false,
'emphasis' => [
'bold' => true, // Enable bold emphasis
'italic' => true, // Enable italic emphasis,
"subscript" => false,
"superscript" => true,
],
'smarty' => [
'substitutions' => [
'left-double-quote' => '"', // Double bottom quote
'right-double-quote' => '"', // Double top quote
"ndash" => '–',
"mdash" => '—',
"left-single-quote" => "'",
"right-single-quote" => "'",
"left-angle-quote" => '«',
"right-angle-quote" => '»',
"ellipses" => "..."
],
]
]);
I just found a test case if that helps. It seems to be the fault of block math.
$$Y=ubrace(1,0,1,0;)_CX$$
- $C=(1,0,1,0;)$
- $CA=(0,1,0,1;)$
- $CA^2=(b,0,a,0;)$
- $CA^3=(0,b,0,a;)$
The above breaks but :
- $C=(1,0,1,0;)$
- $CA=(0,1,0,1;)$
- $CA^2=(b,0,a,0;)$
- $CA^3=(0,b,0,a;)$
seems to work.
Should be fixed in 1.2.9
if it continue to give you trouble let me now :)
Doesn't seem to work, I will avoid math blocks for now. Thanks for your rapid support.
(as a fix I set the double dollar delimiters as inline, and made a change to my js math processor)
Doesn't seem to work, I will avoid math blocks for now. Thanks for your rapid support.
(as a fix I set the double dollar delimiters as inline, and made a change to my js math processor)
So the issue is only present when using single dollar delimiters for inline?
Also just to help me investigate the issue, what PHP version, Parsedown version, ParsedownExnteded are you using? and if you are using ParsedownExtra, what version of that too
The issue only occurs with the double dollar delimiters for blocks, here are the versions i am using
Isn't the issue a priority problem where the delimiters for inline math are parsed before the delimiters for block math ?
Describe the bug
When using inline math, it breaks the markup after :
The same can be observed with lists and titles
Expected Behavior
No response
Code of Conduct