disable headings in markdown (#1843)
This commit is contained in:
@@ -16,6 +16,7 @@ Perform EACH version specific task between your version and the new one, otherwi
|
|||||||
- Sessions are now stored in the database (all users have to re-login after upgrade)
|
- Sessions are now stored in the database (all users have to re-login after upgrade)
|
||||||
- New permissions: `lockdown_grace_timesheet`, `lockdown_override_timesheet`, `view_all_data`
|
- New permissions: `lockdown_grace_timesheet`, `lockdown_override_timesheet`, `view_all_data`
|
||||||
- Fixed team permissions on user queries: depending on your previous team & permission setup your users might see less data (SUPER_ADMINS see all data, but new: ADMINS only see all data if they own the `view_all_data` permission)
|
- Fixed team permissions on user queries: depending on your previous team & permission setup your users might see less data (SUPER_ADMINS see all data, but new: ADMINS only see all data if they own the `view_all_data` permission)
|
||||||
|
- Markdown does not support headings any more, text like `# foo` is not converted to `<h1 id="foo">foo</h1>` anymore
|
||||||
|
|
||||||
### Developer
|
### Developer
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,36 @@ class ParsedownExtension extends \Parsedown
|
|||||||
{
|
{
|
||||||
private $ids = [];
|
private $ids = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overwritten to prevent # to show up as headings for two reasons:
|
||||||
|
* - Hashes are often used to cross link issues in other systems
|
||||||
|
* - Headings should not occur in time record listings
|
||||||
|
*/
|
||||||
|
protected $BlockTypes = [
|
||||||
|
'*' => ['Rule', 'List'],
|
||||||
|
'+' => ['List'],
|
||||||
|
'-' => ['SetextHeader', 'Table', 'Rule', 'List'],
|
||||||
|
'0' => ['List'],
|
||||||
|
'1' => ['List'],
|
||||||
|
'2' => ['List'],
|
||||||
|
'3' => ['List'],
|
||||||
|
'4' => ['List'],
|
||||||
|
'5' => ['List'],
|
||||||
|
'6' => ['List'],
|
||||||
|
'7' => ['List'],
|
||||||
|
'8' => ['List'],
|
||||||
|
'9' => ['List'],
|
||||||
|
':' => ['Table'],
|
||||||
|
'<' => ['Comment', 'Markup'],
|
||||||
|
'=' => ['SetextHeader'],
|
||||||
|
'>' => ['Quote'],
|
||||||
|
'[' => ['Reference'],
|
||||||
|
'_' => ['Rule'],
|
||||||
|
'`' => ['FencedCode'],
|
||||||
|
'|' => ['Table'],
|
||||||
|
'~' => ['FencedCode'],
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwritten to add support for file:///
|
* Overwritten to add support for file:///
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class MarkdownExtensionTest extends TestCase
|
|||||||
$config = new TimesheetConfiguration($loader, ['markdown_content' => true]);
|
$config = new TimesheetConfiguration($loader, ['markdown_content' => true]);
|
||||||
$sut = new MarkdownExtension(new Markdown(), $config);
|
$sut = new MarkdownExtension(new Markdown(), $config);
|
||||||
$this->assertEquals('<p><em>test</em></p>', $sut->markdownToHtml('*test*'));
|
$this->assertEquals('<p><em>test</em></p>', $sut->markdownToHtml('*test*'));
|
||||||
$this->assertEquals('<h1 id="foobar">foobar</h1>', $sut->markdownToHtml('# foobar'));
|
$this->assertEquals('<p># foobar</p>', $sut->markdownToHtml('# foobar'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTimesheetContent()
|
public function testTimesheetContent()
|
||||||
|
|||||||
@@ -22,21 +22,21 @@ class MarkdownTest extends TestCase
|
|||||||
{
|
{
|
||||||
$sut = new Markdown();
|
$sut = new Markdown();
|
||||||
$this->assertEquals('<p><em>test</em></p>', $sut->toHtml('*test*'));
|
$this->assertEquals('<p><em>test</em></p>', $sut->toHtml('*test*'));
|
||||||
$this->assertEquals('<h1 id="foobar">foobar</h1>', $sut->toHtml('# foobar'));
|
$this->assertEquals('<p># foobar</p>', $sut->toHtml('# foobar'));
|
||||||
$html = <<<'EOT'
|
$html = <<<'EOT'
|
||||||
<p>foo bar</p>
|
<p>foo bar</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>sdfasdfasdf</li>
|
<li>sdfasdfasdf</li>
|
||||||
<li>asdfasdfasdf</li>
|
<li>asdfasdfasdf</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h1 id="test">test</h1>
|
<p># test<br />
|
||||||
<p>asdfasdfa</p>
|
asdfasdfa</p>
|
||||||
<pre><code>ssdfsdf</code></pre>
|
<pre><code>ssdfsdf</code></pre>
|
||||||
<p><a href="http://example.com/foo-bar.html" target="_blank">http://example.com/foo-bar.html</a><br />
|
<p><a href="http://example.com/foo-bar.html" target="_blank">http://example.com/foo-bar.html</a><br />
|
||||||
<a href="file:///home/kimai/images/beautiful-flower.png" target="_blank">file:///home/kimai/images/beautiful-flower.png</a></p>
|
<a href="file:///home/kimai/images/beautiful-flower.png" target="_blank">file:///home/kimai/images/beautiful-flower.png</a></p>
|
||||||
<p>sdfsdf <a href="#test-1">asdfasdf</a> asdfasdf</p>
|
<p>sdfsdf <a href="#test-1">asdfasdf</a> asdfasdf</p>
|
||||||
<h1 id="test-1">test</h1>
|
<p># test<br />
|
||||||
<p>aasdfasdf<br />
|
aasdfasdf<br />
|
||||||
1111<br />
|
1111<br />
|
||||||
222</p>
|
222</p>
|
||||||
EOT;
|
EOT;
|
||||||
@@ -70,10 +70,10 @@ EOT;
|
|||||||
$sut = new Markdown();
|
$sut = new Markdown();
|
||||||
|
|
||||||
$html = <<<'EOT'
|
$html = <<<'EOT'
|
||||||
<h1 id="test">test</h1>
|
<p># test<br />
|
||||||
<h2 id="test-1">test</h2>
|
## test<br />
|
||||||
<h3 id="test-2">test</h3>
|
### test<br />
|
||||||
<h1 id="test-3">test</h1>
|
# test</p>
|
||||||
EOT;
|
EOT;
|
||||||
|
|
||||||
$markdown = <<<EOT
|
$markdown = <<<EOT
|
||||||
|
|||||||
Reference in New Issue
Block a user