import html

from flask import render_template, has_request_context


def basic_msg(content: str):
    return basic_msg_html(content, is_content_safe=False)


def basic_msg_html(content_html: str, is_content_safe: bool = True):
    if not is_content_safe:
        content_html = html.escape(content_html)

    if not has_request_context():
        return content_html

    return render_template('basic_msg.html', contentHTML=content_html)
