Skip to content

Add basic text styling support (headings, underline, bullet points, links) #185

Description

@amarradi

📝 Description

I’d like to request a built-in text styling feature to enhance the note editing experience in Leafpad.

The following formatting options should be supported:

Headings (e.g. large bold text for section titles)

Underline

Bullet points

Clickable links (e.g. https://example.com should be tappable)


✅ Requirements

Styling should be applied via the native text selection menu, similar to WhatsApp or Google Keep (e.g. long-press → choose “Heading”, “Underline” etc.)

Styling must be immediately visible in the editor (WYSIWYG – What You See Is What You Get)

No external libraries should be used (no Markdown or rich-text libraries)

No Jetpack Compose – implementation should use the traditional View system

All applied styles must be saved persistently and correctly restored when reopening a note

The implementation must follow the MVVM architecture:

Business logic (e.g. applying styles or transforming text) must live in the ViewModel or a helper class

The View layer (Activity/Fragment) should only handle user input and observe LiveData

Custom span serialization (e.g. Html.toHtml() or manual) can be handled at ViewModel or Repository level


🧠 Suggested Implementation

Use Android’s built-in SpannableString and spans:

StyleSpan(Typeface.BOLD) for headings

UnderlineSpan for underlined text

BulletSpan for bullet points

URLSpan for clickable links

Extend ActionMode.Callback to show custom actions in the text selection menu

Persist styled content using Html.toHtml() / Html.fromHtml() or custom converters

Expose the styled content as LiveData in the ViewModel


📋 Tasks

[ ] Define data model changes (e.g. storing styled text as HTML or custom format)

[ ] Create helper methods to apply/remove spans (heading, underline, bullet, link)

[ ] Update NoteViewModel to expose styled content as LiveData

[ ] Implement serialization and deserialization of styles to and from persistent storage

[ ] Extend ActionMode.Callback to support custom formatting actions:

[ ] Apply Heading

[ ] Apply Underline

[ ] Insert Bullet Point

[ ] Insert or detect Clickable Link

[ ] Update NoteEditActivity to observe the styled content and update UI accordingly

[ ] Apply styling changes in real time (WYSIWYG)

[ ] Ensure correct restoration of styling when reopening notes

[ ] Keep all logic outside the UI layer – ViewModel and helper classes only

[ ] Test across different screen sizes, themes (light/dark), and Android versions

[ ] Optional: Add undo support

[ ] Optional: Add accessibility support for formatted content


🏷 Labels

enhancement UI/UX text formatting MVVM
Optionally: good first issue (if scoped to a single formatting type like underline)

Metadata

Metadata

Assignees

No one assigned

    Labels

    New featureLabel for new featuregood first issueGood for newcomershelp wantedExtra attention is needednice to haveIt would be nice if this were implemented

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions