Repository navigation
Description
Describe the bug
wi create -d and wi update -d wrap the value as f"<p>{description}</p>" (commands/work_items.py). The help text says the value is "plain text", while the README/skill say it is raw HTML. In practice:
-
Plain text: newlines are lost (same root cause as fix: comment body newlines are lost (stored as raw HTML without <br>/<p>) #17 for comments; docs were fixed in fix: doc create crashes, --content loses formatting, doc delete silently no-ops #21/fix(documents): doc create/update content conversion and archive-before-delete #22 with
body_to_html). -
HTML with block elements (
<h2>,<ul>,<table>,<pre>): the value is nested inside a<p>, which is invalid HTML. The Plane editor repairs it by splitting the paragraph, and the stored description starts with an empty<p></p>. It renders, but only by accident. -
Appending with
wi update -i(added in feat(attachments): work item attachments and inline description images #12): the server returnsdescription_htmlwrapped in a<div>, and the image<p>is appended after it as is. The server wraps the result again, so eachwi update -iadds one more level:<div><div><p>Old</p></div><p><img src="…" /></p></div>. It renders the same, but the stored HTML grows with every append.
Workaround used for a bulk create of 31 issues with rich descriptions: pass -d "</p>${html}<p>" so the wrapper closes and reopens around the real content.
Expected behavior
-
Convert
-dthroughplanecli.utils.body_html.body_to_html, the functiondoc create/updatealready use. It already turns plain text into paragraphs (one<p>per blank-line-separated block,<br/>for single newlines), links bare URLs and converts code spans. -
If the value already looks like HTML (starts with
<afterstrip()), store it as is.body_to_htmldoes not do this yet:body_to_html('<h2>T</h2><ul><li>x</li></ul>')returns'<p><h2>T</h2><ul><li>x</li></ul></p>', so the pass-through belongs inbody_to_html, where it also fixesdoc --content. -
Fix the
--descriptionhelp text to say which formats are accepted. -
When
wi update -iappends to an existing description, unwrap the server's outer<div>first, so repeated appends do not nest.
Related
-
Umbrella: fix: --help describes input formats that -d, --body and --content do not implement #34 (help text and markdown input for
-d,--body,--content). fix(comments): convert comment bodies with body_to_html and stop nesting links #40 is the comment half of the same change. -
Module descriptions (
module update -d) are a plain-text field (description, notdescription_html), and the web UI shows them in a read-only textarea with no formatting or clickable links. Worth a note in the help text so users don't send HTML there.
Environment
- planecli 0.5.1, plane-sdk 0.2.6
- Plane v2.1.2 Commercial, self-hosted
Activity