Fix list item notes showing raw HTML in edit textarea#3868
Open
mvanhorn wants to merge 1 commit intobookwyrm-social:mainfrom
Open
Fix list item notes showing raw HTML in edit textarea#3868mvanhorn wants to merge 1 commit intobookwyrm-social:mainfrom
mvanhorn wants to merge 1 commit intobookwyrm-social:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 becauseitem.notesis stored as HTML afterto_markdown()conversion on save, but the edit template renders the stored value without stripping tags.Changes
Added Django's
striptagstemplate filter toitem_notes_field.htmlso the textarea shows clean text when editing. The round-trip stays intact - on save,to_markdown()inlist_item.pyconverts the plain text back to HTML.File:
bookwyrm/templates/lists/item_notes_field.html(line 16)Testing
striptagsruns afterdefault, stripping any HTML from stored notesviews/list/list_item.py:22appliesto_markdown()before saving, so the round-trip (HTML -> stripped text -> markdown -> HTML) preserves contentFixes #3608
This contribution was developed with AI assistance (Claude Code).