Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
a176175
Update README.md
simondelphia Jun 28, 2023
619d0f0
Update README.md
simondelphia Jun 28, 2023
51d2691
Fix typos in markdown imports in readmes
simondelphia Jul 7, 2023
e092385
Update font: Courier -> Courier New
bi3ri Oct 22, 2023
7484044
fix: lib is broken as it is not pure javasript, but a mix out of type…
macrozone Dec 4, 2023
25fc44a
Merge pull request #12 from bi3ri/patch-1
RonRadtke Sep 10, 2024
7762a30
Merge pull request #11 from simondelphia/patch-1
RonRadtke Sep 10, 2024
75a757e
Update package.json
RonRadtke Jan 21, 2025
fff235a
implement tests
RonRadtke Apr 2, 2026
c8f99ff
update dependencies
RonRadtke Apr 2, 2026
ee1510b
type cleanup
RonRadtke Apr 2, 2026
b7c8d6f
agents.md
RonRadtke Apr 2, 2026
bb519ee
editor
RonRadtke Apr 2, 2026
8c9fe0c
implement preview
RonRadtke Apr 2, 2026
a69d6ce
composer behaviour
RonRadtke Apr 2, 2026
210873a
improvements
RonRadtke Apr 2, 2026
4c0327e
clean up, sanity for tables and urls
RonRadtke Apr 2, 2026
df3d674
example app
RonRadtke Apr 2, 2026
625d6c1
make sure to not build example app in npm build
RonRadtke Apr 2, 2026
2d004e0
feat: support custom editor inputs
RonRadtke Apr 3, 2026
9cda319
fix: label block links for accessibility
RonRadtke Apr 3, 2026
763bb4b
format
RonRadtke Apr 3, 2026
357b521
bit of reorganizing structure
RonRadtke Apr 3, 2026
8a12de1
example app style fixes
RonRadtke Apr 3, 2026
b68b0bf
feat: expose strikethrough in composer toolbar
RonRadtke Apr 3, 2026
7b2eef0
feat: expose ordered lists in composer toolbar
RonRadtke Apr 3, 2026
df4f588
feat: expose headings in composer toolbar
RonRadtke Apr 3, 2026
dabff59
feat: expose block quotes in composer toolbar
RonRadtke Apr 3, 2026
99c24da
feat: expose inline code in composer toolbar
RonRadtke Apr 3, 2026
f40c7e7
lot of fixes and bundle headings etc
RonRadtke Apr 3, 2026
8dbe290
add props to control input quick buttons
RonRadtke Apr 3, 2026
71d846b
enhance accessibility test
RonRadtke Apr 3, 2026
89e78bb
allow icon as label for toolbar buttons
RonRadtke Apr 3, 2026
ac21214
add plugin support and add warning plugin to example
RonRadtke Apr 4, 2026
b846d9c
allow custom buttons for plugins
RonRadtke Apr 4, 2026
dc2f749
cleanup
RonRadtke Apr 5, 2026
ac6f790
adds underline support as own bundled plugin
RonRadtke Apr 5, 2026
a7fbf7e
update package json
RonRadtke Apr 8, 2026
6389011
migrate to dist folder and icons isntead of text for the edit nbuttons
RonRadtke Apr 8, 2026
0b1191a
fix icons
RonRadtke Apr 25, 2026
f8199fb
bugfixes
RonRadtke May 24, 2026
699e202
add streaming
RonRadtke May 24, 2026
8cce659
adds syntax highlighting in a code fragment and possibility to copy code
RonRadtke May 24, 2026
d26a403
add darkmode to the example app and fix some accessibility
RonRadtke May 24, 2026
0b6156a
update docu
RonRadtke May 26, 2026
6afa433
rework styling a bit
RonRadtke Jun 2, 2026
3705763
- Add streaming support
RonRadtke Jun 13, 2026
8f89203
version
RonRadtke Jun 29, 2026
9b24d3c
small cleanup
RonRadtke Jun 29, 2026
da55017
fix/run prettier
RonRadtke Jun 29, 2026
78f2534
enhance readme a bit
RonRadtke Jun 29, 2026
0d74bde
who doesn't like fancy icons in th ereadme
RonRadtke Jun 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"presets": [
"module:metro-react-native-babel-preset"
"module:@react-native/babel-preset"
]
}
56 changes: 32 additions & 24 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
module.exports = {
extends: [
'@react-native-community',
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'prettier',
],
plugins: ['@typescript-eslint'],
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
extends: [
'@react-native',
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'prettier',
],
plugins: ['@typescript-eslint'],
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: require('./package.json').peerDependencies.react,
settings: {
react: {
version: require('./package.json').peerDependencies.react,
},
'import/ignore': ['node_modules'],
},
'import/ignore': ['node_modules'],
}
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'react/prop-types': 'off',
},
},
],
};
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v3

- name: Install dependencies
run: npm install --ci
run: npm ci

- name: Run ESLint
run: npm run lint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: npm publish

on:
release:
types: [created]
types: [ created ]

jobs:
build:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
yarn-error.log
yarn.lock
.eslintcache
/dist
/STATUS.md
13 changes: 9 additions & 4 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module.exports = {
bracketSpacing: false,
singleQuote: true,
trailingComma: 'all',
useTabs: false,
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
singleQuote: true,
trailingComma: 'all',
tabWidth: 4,
objectWrap: 'collapse',
singleAttributePerLine: false,
printWidth: 9999,
};
77 changes: 77 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# AGENTS.md

## Repo Summary

This repository contains `@ronradtke/react-native-markdown-display`, a React Native markdown renderer.

The library:

- parses markdown with `markdown-it`
- normalizes the token stream
- converts tokens into an internal AST
- renders that AST with native React Native components, not a WebView

The source of truth is TypeScript in `src/`.
Build output is generated into `dist/`.

Do not hand-edit generated files in `dist/` unless the user explicitly asks for generated output changes only. Make source changes in `src/` and rebuild.

## Important Paths

- `src/index.tsx`: public entrypoint and exports
- `src/lib/parser.ts`: markdown string -> token cleanup -> AST pipeline
- `src/lib/AstRenderer.ts`: AST traversal and render dispatch
- `src/lib/renderRules.tsx`: default React Native rendering rules
- `src/lib/styles.ts`: default style map
- `src/lib/types.ts`: shared public/internal TypeScript types
- `src/lib/util/*`: token, AST, style, and helper utilities
- `__tests__/`: Jest test suite
- `dist/`: generated JS and declaration output

## Working Rules

- Keep implementation in TypeScript.
- Keep typings strict.
- Do not introduce `any` or `unknown` types.
- Prefer React Native types and library-provided types over local placeholder types.
- If a third-party boundary is awkward, narrow it with explicit unions or helper functions instead of falling back to `any`/`unknown`.
- Preserve the current parser/renderer architecture unless the task explicitly requires architectural change.
- Keep public API compatibility in mind. This library is consumed by external apps.

## Build And Verification

Run these after meaningful changes:

- `npm run typecheck`
- `npm run lint`
- `npm test -- --runInBand`

If public exports or package output changed, also run:

- `npm run build`

## TypeScript Expectations

- Source types should generate the package declarations. Do not reintroduce handwritten `.d.ts` files for source modules.
- Prefer explicit interfaces/types for AST nodes, render rules, and helper boundaries.
- Use React/React Native types for components, props, styles, and nodes where available.
- Keep optionality exact. This repo uses strict TypeScript settings.

## Testing Guidance

- Tests are written in TypeScript.
- Prefer focused tests on parser behavior, AST shape, renderer behavior, and public component behavior.
- When fixing bugs in token normalization or rendering, add or update a Jest test that proves the behavior.

## Style And Editing Notes

- Keep changes minimal and local when possible.
- Avoid broad refactors unless they materially improve correctness or maintainability.
- Preserve existing public names unless the user asks for a breaking API change.
- When changing style or render-rule behavior, consider React Native platform behavior and existing tests.

## Generated Output

- `package.json` points `main` and `types` at `dist/index.js` and `dist/index.d.ts`.
- After source changes, regenerate `dist/` with `npm run build`.
- If `src/` changes and `dist/` is committed in the repo, keep them in sync.
Loading