How to style product description output in sale.order report template?

I wanted to set the first line of the product description to BOLD so I added the following code to my model

def setFirstLineBold(self,txt):
# code magic to set first line bold
return txt

def render_html(self, docids, data=None):
    report = self.env['report']._get_report_from_name(self._template)  
    docargs = {
        'doc_ids': self._ids,
        'doc_model': report.model,
        'docs': self.env['sale.order'].browse(self._ids),
        'setFirstLineBold': self.setFirstLineBold

    return report_obj.render(self._template, docargs)

I then called the method inside my template

<t t-foreach="layout_category['lines']" t-as="l">
    <tr class="table-body">
        <span t-esc="doc.setFirstLineBold("/></td> 

But what happens then is actually exactly the opposite of what I want to achieve: The formatting that previously existed in the description text (the line breaks), which were previously shown with line breaks in the printed pdf-report, has been completely removed.

Now my question: How can I create formatting for the description text? I just want to make the first line bold.

It looks like the linebreaks will not be recognized as such or will be removed.
Unfortunately, the debugging seems impossible (not really, but extremly complicated) as I develop inside a docker container - Iā€™m new to Flectra development, if someone gives me a tip here - thank you!

Thanks a lot!

EDIT: I already found out that this works:

def setFirstLineBold(self,txt):
    txt = txt.replace('\n', '<br/>')
    return txt

but the HTML is not interpreted, so it only shows '<br/>' instead of '\n' inside the description part of the PDF

Using RAW instead of ESC solves the problem:

<span t-raw="doc.setFirstLineBold("/>
1 Like

t-esc will escape special chars and remove html tags.

t-raw makes raw output as it is