mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Markdown parsing for line items
This commit is contained in:
parent
c9334daa3f
commit
d701125bf1
@ -346,6 +346,8 @@ class Design extends BaseDesign
|
|||||||
|
|
||||||
$items = $this->transformLineItems($this->entity->line_items, $type);
|
$items = $this->transformLineItems($this->entity->line_items, $type);
|
||||||
|
|
||||||
|
$this->processMarkdownOnLineItems($items);
|
||||||
|
|
||||||
if (count($items) == 0) {
|
if (count($items) == 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -330,4 +330,18 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
|
|
||||||
return $converter->convertToHtml($markdown);
|
return $converter->convertToHtml($markdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function processMarkdownOnLineItems(array &$items)
|
||||||
|
{
|
||||||
|
// Use setting to determinate if parsing should be done.
|
||||||
|
// 'parse_markdown_on_pdfs'
|
||||||
|
|
||||||
|
foreach ($items as $key => $item) {
|
||||||
|
foreach ($item as $variable => $value) {
|
||||||
|
$item[$variable] = DesignHelpers::parseMarkdownToHtml($value ?? '');
|
||||||
|
}
|
||||||
|
|
||||||
|
$items[$key] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,10 @@ trait PdfMakerUtilities
|
|||||||
$contains_html = false;
|
$contains_html = false;
|
||||||
|
|
||||||
if (isset($child['content'])) {
|
if (isset($child['content'])) {
|
||||||
$child['content'] = nl2br($child['content']);
|
// Commented cause it keeps adding <br> at the end, if markdown parsing is turned on.
|
||||||
|
// Should update with 'parse_markdown_on_pdfs' setting.
|
||||||
|
|
||||||
|
// $child['content'] = nl2br($child['content']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// "/\/[a-z]*>/i" -> checks for HTML-like tags:
|
// "/\/[a-z]*>/i" -> checks for HTML-like tags:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user