def linefeed2br(s):
    """Convert linefeeds to <br> tags.

    Markdown uses <br> tags for linebreaks in tables. This
    function allows to convert a text with linebreaks accordingly.
   
    Args:
        s (str): string to convert

    returns:
        str: a string with <br> tags for linefeeds
    """
    r = None
    for line in iter(s.splitlines()):
        if r is None:
            r = line.strip('\n ')
        else:
            r = r + '<br>' + line.strip('\n ')
    if r is None:
        r = ''
    return r
