[nodebb-plugin-write-api] How to post HTML content ?

  • Hi,
    I am trying to do this -
    POST /api/v1/topics?_uid=1 HTTP/1.1
    Host: xxxx:4567
    Authorization: Bearer xxxx
    Content-Type: application/x-www-form-urlencoded
    cid=2&title=myTtile&content=<p>line 1</p>start-link <a href="yahoo.com">yahoo</a> end-link<p>line 2</p>

    But, the HTML content is rendered as-is. What do I have to do to correct this ?
    Thanks in advance.

  • Community Rep

    It does write the HTML to the post, if you query the database, you will see the HTML is there. But you can't see it on the browser because the markdown plugin is parsing it out (for good reasons).

    If you are on a private forum, you can turn HTML sanitization off in the Markdown settings.

  • Thanks...I will turn off HTML sanitation

  • Admin

    @assamese said in [nodebb-plugin-write-api] How to post HTML content ?:

    Thanks...I will turn off HTML sanitation

    Please keep in mind that this is quite dangerous as it means anybody can post HTML, even malicious HTML.

    You may want to consider using https://www.npmjs.com/package/nodebb-plugin-sanitizehtml instead.

  • Definitely use Sanitize HTML. It is extremely bad if you don't.

  • I installed and activated the plugin-sanitizehtml , restarted NodeBB as instructed, saved the default plug-in settings from ACP.
    But, now all my HTML tags have been stripped off (I can tell by looking at the source)
    What am I missing ?
    BTW, I uninstalled the Markdown-plugIn before installing the sanitizehtml plugIn.

Log in to reply

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.