You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## 📝 Description
This PR adds support for remark plugins to allow users take advantage of
the remark ecosystem and extend the lib's behavior (when using plugins
that add new nodes, users will have to inject the needed renderers using
the `customRenderers` prop). It finishes the work started in PR #58 by
[szymonograbek](https://github.com/szymonograbek). It also adds a
section in the `README` file to explain how to use plugins with the lib.
## 📌 Related Issue (Optional)
Link: #43
## 📷 Screenshots (Optional)
Example using the `remark-cjk-friendly` plugin.
| Before | After |
| ------ | ------ |
| <img height="550"
src="https://github.com/user-attachments/assets/fcb98d17-7065-4c4e-a369-a593c381c439"
/> | <img height="550"
src="https://github.com/user-attachments/assets/45dfbd55-ef12-41fb-afba-c7d85c9a3f4f"
/> |
## 📄 Test Markdown File (Optional)
File `05_cjk_plugin_example.md` included in the PR
## ✅ Checklist
- [x] My PR title follows the Conventional Commit format (e.g. `feat:`,
`fix:`, `chore:`)
- [x] This PR addresses the related issue (if applicable)
- [x] I have attached a sample Markdown file (`.md`) used for testing
- [x] I have attached at least one screenshot of the rendered output
(light and/or dark mode preferred)
- [x] I have run `pnpm run lint:fix` to fix formatting and lint errors
- [x] I have tested the changes in the example app (`pnpm i && cd
example && pnpm i && pnpm run ios`)
---------
Co-authored-by: Szymon Ograbek <szymon.ograbek2@gmail.com>
Checkout [renderers](./src/renderers/) for the default implementations. To ensure type safety when creating custom renderers, you can use the `RendererArgs<MdastType>` props interface.
112
113
114
+
Note that the library ships with renderers for the `remark-gfm` plugin since we think it is often used. You don't need to pass custom renderers (though you can!) for this plugin.
115
+
113
116
## Supported Themes
114
117
115
-
Themes are pre-defined style collections that provide consistent visual styling for markdown content. Currently, we support two built-in themes:
118
+
Themes are pre-defined style collections that provide consistent visual styling for markdown content. Currently, we support two built-in themes:
116
119
117
120
1. default
118
121
2. serif
@@ -124,7 +127,7 @@ To use a theme, you can follow this pattern:
124
127
import { themes } from"react-native-remark"
125
128
const { serifTheme } = themes;
126
129
127
-
//Thene you can use it with
130
+
//Then you can use it with
128
131
<Markdown theme={serifTheme} .../>
129
132
```
130
133
@@ -134,28 +137,45 @@ Custom styles will override the selected theme's default styles.
134
137
135
138
Checkout [default.tsx](./src/themes/default.tsx) for default styles.
136
139
137
-
| Style Key | Description | Example Markdown Element |
|`list`| List container styling | Lists (`- item` or `1. item`) |
156
+
|`listItem`| List item styling | Each list item |
157
+
|`paragraph`| Paragraph text styling | Normal paragraphs |
158
+
|`strong`| Bold text style |**bold**|
159
+
|`tableCell`| Table cell text styling | Table cell contents |
160
+
|`text`| General text style | Plain text |
161
+
|`thematicBreak`| Horizontal rule styling | --- |
162
+
163
+
## Remark plugins usage
164
+
165
+
You can inject Remark plugins _via_ the `remarkPlugins` prop. For example, you can use `remark-cjk-friendly` to add support for bold (`**`) with Chinese, Japanese and Korean alphabets by doing the following:
0 commit comments