Skip to content

Fix list item notes showing raw HTML in edit textarea#3868

Open
mvanhorn wants to merge 1 commit intobookwyrm-social:mainfrom
mvanhorn:fix-edit-notes-html-display
Open

Fix list item notes showing raw HTML in edit textarea#3868
mvanhorn wants to merge 1 commit intobookwyrm-social:mainfrom
mvanhorn:fix-edit-notes-html-display

Conversation

@mvanhorn
Copy link
Copy Markdown

Summary

When editing a note on a book in a list, the textarea displays raw HTML tags (e.g. <p>My note</p>) instead of plain text. This happens because item.notes is stored as HTML after to_markdown() conversion on save, but the edit template renders the stored value without stripping tags.

Changes

Added Django's striptags template filter to item_notes_field.html so the textarea shows clean text when editing. The round-trip stays intact - on save, to_markdown() in list_item.py converts the plain text back to HTML.

File: bookwyrm/templates/lists/item_notes_field.html (line 16)

- >{{ item.notes|default:'' }}</textarea>
+ >{{ item.notes|default:''|striptags }}</textarea>

Testing

  • Verified the template filter chain: striptags runs after default, stripping any HTML from stored notes
  • The save path in views/list/list_item.py:22 applies to_markdown() before saving, so the round-trip (HTML -> stripped text -> markdown -> HTML) preserves content

Fixes #3608

This contribution was developed with AI assistance (Claude Code).

When editing a note on a book list, the raw HTML stored in the database
was displayed in the textarea. Notes are converted to HTML via
to_markdown() on save, but the edit form showed the raw markup instead
of plain text. Adding the striptags filter converts the stored HTML back
to readable text for editing.

Fixes bookwyrm-social#3608

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

List 'edit notes' exposes html

1 participant