Skip to content

Preserve bold/italic formatting in teacher texts#508

Open
mircealungu wants to merge 2 commits intomasterfrom
feature/inline-formatting
Open

Preserve bold/italic formatting in teacher texts#508
mircealungu wants to merge 2 commits intomasterfrom
feature/inline-formatting

Conversation

@mircealungu
Copy link
Member

Summary

  • When teachers use bold/italic in the rich text editor, the formatting was lost during tokenization because get_text() strips all HTML tags
  • Added 3 helper methods to Article that re-parse htmlContent after tokenization and tag individual tokens with is_bold/is_italic flags
  • Added is_bold/is_italic fields to Token, serialized only when True to minimize payload

Notes

  • No DB migration needed — formatting is computed at tokenization time from existing htmlContent
  • Existing cached articles work as-is; formatting appears when cache is refreshed
  • Companion PR: zeeguu/web (renders the flags as <strong>/<em>)

Test plan

  • Create a teacher text with bold and italic words
  • Open the text as a student in the reader
  • Verify bold/italic words render with correct formatting
  • Verify non-formatted articles still render normally

🤖 Generated with Claude Code

When teachers use bold/italic in the rich text editor, the inline
formatting was lost during tokenization because get_text() strips
all HTML tags. This re-parses the article's htmlContent after
tokenization to tag individual tokens with is_bold/is_italic flags.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link

ArchLens - No architecturally relevant changes to the existing views

…rd find()

- Extract duplicated block tag list into BLOCK_TAGS constant
- Filter empty elements in _get_html_block_elements to stay aligned with fragments
- Use early-continue when str.find() returns -1 to avoid stalling the cursor

Co-Authored-By: Claude Opus 4.6 (1M context) <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.

1 participant