docs: Rich text formatting section - #713
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new “Rich text formatting” documentation section to the Docusaurus docs, introducing core formatting features of react-native-enriched-html with interactive editor examples.
Changes:
- Adds new interactive example components for basic styles, links, mentions, lists, inline images, text alignment, and text shortcuts.
- Replaces placeholder
.mdpages with full.mdxpages that embed the interactive examples. - Documents key API concepts for each feature (props/events/ref methods) with runnable snippets.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/src/examples/BasicStylesEditor.tsx | Adds interactive toolbar example for inline + paragraph style toggles. |
| docs/src/examples/LinksEditor.tsx | Adds example showing autolink via linkRegex and manual linking via setLink. |
| docs/src/examples/MentionEditor.tsx | Adds minimal mention insertion example using setMention. |
| docs/src/examples/ListsEditor.tsx | Adds list toggling example (unordered/ordered/checkbox) driven by onChangeState. |
| docs/src/examples/ImagesEditor.tsx | Adds inline image insertion example using setImage. |
| docs/src/examples/TextAlignmentEditor.tsx | Adds alignment buttons example using setTextAlignment and state.alignment. |
| docs/src/examples/TextShortcutsEditor.tsx | Adds example configuring textShortcuts for paragraph + inline shortcuts. |
| docs/docs/rich-text-formatting/basic-styles.mdx | New “Basic styles” page describing inline vs paragraph styles with embedded example. |
| docs/docs/rich-text-formatting/basic-styles.md | Removes placeholder TODO page (replaced by .mdx). |
| docs/docs/rich-text-formatting/links.mdx | New “Links” page covering autolinks vs manual links with embedded example. |
| docs/docs/rich-text-formatting/links.md | Removes placeholder TODO page (replaced by .mdx). |
| docs/docs/rich-text-formatting/mentions.mdx | New “Mentions” page covering indicators, setMention, and mention events. |
| docs/docs/rich-text-formatting/mentions.md | Removes placeholder TODO page (replaced by .mdx). |
| docs/docs/rich-text-formatting/lists.mdx | New “Lists” page describing list toggles and behavior with embedded example. |
| docs/docs/rich-text-formatting/lists.md | Removes placeholder TODO page (replaced by .mdx). |
| docs/docs/rich-text-formatting/inline-images.mdx | New “Inline images” page describing setImage and failure behavior with example. |
| docs/docs/rich-text-formatting/inline-images.md | Removes placeholder TODO page (replaced by .mdx). |
| docs/docs/rich-text-formatting/text-alignment.mdx | New “Text alignment” page describing setTextAlignment + state reporting. |
| docs/docs/rich-text-formatting/text-alignment.md | Removes placeholder TODO page (replaced by .mdx). |
| docs/docs/rich-text-formatting/text-shortcuts.mdx | New “Text shortcuts” page explaining paragraph vs inline shortcuts and defaults. |
| docs/docs/rich-text-formatting/text-shortcuts.md | Removes placeholder TODO page (replaced by .mdx). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (3)
docs/docs/rich-text-formatting/text-shortcuts.mdx:12
- The prose says typing
#turns a line into a heading, but your configured trigger is'# '(hash + space). Using#without the trailing space is misleading for readers trying the feature.
Text shortcuts let users format as they type, the way Markdown editors do -
typing `#` turns a line into a heading, wrapping a word in `**` makes it bold.
docs/docs/rich-text-formatting/text-shortcuts.mdx:38
- Paragraph shortcut examples should include the trailing spaces required by the actual triggers (e.g.
#,-,1.). Otherwise readers may try the prefix without a space and think shortcuts are broken.
e.g. `#` for a heading, `-` for a bulleted list. Since a paragraph can only hold
docs/docs/rich-text-formatting/text-shortcuts.mdx:72
- In the "Try it out" section, the paragraph shortcut is described as
#but the example/editor uses the'# 'trigger. Updating this makes the instructions match the actual behavior.
The editor below wires up one shortcut of each kind - a paragraph one (`#` → H1)
and an inline one (`**` → bold). Start a line with `#` and watch it become a
heading, then wrap a word in `**stars**` to bold it.
24db158 to
942497f
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Kacper Żółkiewski <74975508+kacperzolkiewski@users.noreply.github.com>
Co-authored-by: Mikołaj Szydłowski <9szydlowski9@gmail.com>
15c59c4 to
8f82336
Compare
| whether the style is active. The only exceptions to that rule are **mentions**, | ||
| **links** and **inline images**, which work a bit differently. They cannot be toggled |
| - **Unordered list** - `toggleUnorderedList()` | ||
| - **Ordered list** - `toggleOrderedList()` | ||
| - **Checkbox list** - `toggleCheckboxList(checked: boolean)` | ||
|
|
There was a problem hiding this comment.
Same here, about alignement?
| import ListsEditor from '@site/src/examples/ListsEditor'; | ||
| import ListsEditorSrc from '!!raw-loader!@site/src/examples/ListsEditor'; | ||
|
|
||
| # Lists |
There was a problem hiding this comment.
It would be good to mention that ordered and unordered list are recognized automatically by default after typing 1. and - . We can also mention that this behavior can be changed and provide a hyperlink to text shortcuts API
|
|
||
| ::: | ||
| Unlike the paragraph styles from [Basic styles](/rich-text-formatting/basic-styles), | ||
| text alignment does not report its state with the `isActive` / `isConflicting` booleans in `onChangeState`. Instead it exposes `alignment` with its relevant string value. |
There was a problem hiding this comment.
We don't have isConflicting for text alignement?
| - **Paragraph shortcuts** (`h1`–`h6`, `blockquote`, `codeblock`, | ||
| `unordered_list`, `ordered_list`, `checkbox_list`) fire at the **start of a |
There was a problem hiding this comment.
Same here, missing alignment
| ## Try it out | ||
|
|
||
| The editor below wires up one shortcut of each kind - a paragraph one (`#` → H1) | ||
| and an inline one (`**` → bold). Start a line with `#` and watch it become a |
There was a problem hiding this comment.
| and an inline one (`**` → bold). Start a line with `#` and watch it become a | |
| and an inline one (`**` → bold). Start a line with `# ` and watch it become a |
Co-authored-by: Igor Furgała <74370735+exploIF@users.noreply.github.com>
Summary
Rich text formattingsection with: