Repository navigation
Description
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:
- fix: comment body newlines are lost (stored as raw HTML without <br>/<p>) #17: comment newlines are lost
- fix: bare URLs in comment bodies are not linkified #18: bare URLs in comments are not linkified
- fix: backtick code spans in comment bodies render literally #19: backtick code spans in comments render literally
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
- Run
comment createandcomment update--bodythroughbody_to_html, the same way documents do. - In
_linkify, skip URLs that are already inside an<a>…</a>element. - Port the comment-rendering tests from the dropped PR feat(attachments): work item attachments and inline description images #12 commits (
727fa71,e25934a,df13a92) that still apply.
Related
- fix: --help describes input formats that -d, --body and --content do not implement #34 is the umbrella for
-d,--bodyand--contentinput. fix: wi create/update -d wraps HTML in <p>, nesting block elements #32 is thewi -dhalf; both halves go throughbody_to_html, and the HTML pass-through fix: wi create/update -d wraps HTML in <p>, nesting block elements #32 asks for belongs there too.
Activity