Skip to content

fix(comments): convert comment bodies with body_to_html and stop nesting links #40

Open

Description

@cpatrickalves

Problem

comment create and comment update wrap --body in a single <p> (src/planecli/commands/comments.py:173 and :237). Comments written from the CLI lose their line breaks, and bare URLs and code show up as plain text. doc create and doc update already convert text through planecli.utils.body_html.body_to_html, but comments don't use it.

body_to_html also nests anchors when the input already contains a link with a bare URL inside it:

>>> body_to_html('<a href="https://x">see https://y</a>')
'<p><a href="https://x">see <a href="https://y">https://y</a></a></p>'

This issue groups the comment symptoms reported separately; fixing it closes:

Context

PR #12 carried its own comment converter (_body_to_html / _linkify in comments.py). That converter was dropped during the rebase because it was outside the scope of #11 and duplicated utils/body_html.py. body_to_html already fixes four of the five bugs the review found in the PR's converter: URLs inside code spans got linked, a fence with no blank line before it gave invalid HTML, ```c++ fences weren't recognized, and the ) was dropped from .../Foo_(bar). The nested <a> is the one bug that is still open.

Proposal

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions