Contributions are always welcome, no matter how large or small!
We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the code of conduct.
This project is a monorepo managed using Yarn workspaces, with every workspace under packages/* or apps/*.
The libraries:
packages/react-native-enriched-markdown/— the React Native library published to npm: the JS API, its iOS and Android native code, and the web build.packages/core/— the shared C++ core: the md4c parser and the Markdown AST. Every other package compiles these same sources, so there is exactly one parser in the repository.packages/enriched-markdown-ios/— the standalone iOS package: a SwiftPM package wrapping the core in a Swift API, plus an optional LaTeX target.packages/enriched-markdown-android/— the standalone Android package: Gradle modules for the span-baseduirenderer and itscomposewrapper, over aparsermodule that is a JNI binding to the core.
The example apps, each driven by a script from the root directory:
apps/react-native-example/—yarn react-native-example <start|ios|android>. The main development app; Storybook lives here. (The Maestro E2E suite lives at the repository root, in.maestro/.)apps/react-native-macos-example/—yarn react-native-macos-example <start|macos>.apps/react-native-web-example/—yarn react-native-web-example web. The web build running in a browser (Expo).apps/ios-example/—yarn ios-example. A native Swift app using the iOS package directly.apps/android-example/—yarn android-example. A native Android app using the Android package directly.
The documentation site lives in docs/. It is a standalone Docusaurus project with its own yarn.lock, not part of the workspace: run yarn && yarn start inside it, and make sure yarn build passes before merging documentation changes.
To get started with the project, make sure you have the correct version of Node.js installed. See the .nvmrc file for the version used in this project.
git clone https://github.com/software-mansion/enriched-markdown.git
cd enriched-markdown# Install dependencies
yarn
# Build the library (required before running any app)
yarn prepareSince the project relies on Yarn workspaces, you cannot use
npmfor development without manually migrating.
The react-native-example app demonstrates usage of the library. You need to run it to test any changes you make.
It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.
If you want to use Android Studio or Xcode to edit the native code, you can open the apps/react-native-example/android or apps/react-native-example/ios directories respectively in those editors. To edit the Objective-C or Swift files, open apps/react-native-example/ios/EnrichedMarkdownExample.xcworkspace in Xcode and find the source files at Pods > Development Pods > react-native-enriched-markdown.
To edit the Java or Kotlin files, open apps/react-native-example/android in Android studio and find the source files at react-native-enriched-markdown under Android.
You can use various commands from the root directory to work with the project.
To start the packager:
yarn react-native-example startTo run the example app on Android:
yarn react-native-example androidTo run the example app on iOS:
yarn react-native-example iosThe library is Fabric-only, and the example app enables the New Architecture explicitly (newArchEnabled=true in apps/react-native-example/android/gradle.properties, RCT_NEW_ARCH_ENABLED=1 in its Podfile), so there is nothing to switch on first.
Make sure your code passes TypeScript and ESLint. Run the following to verify:
yarn typecheck
yarn lintTo fix formatting errors, run the following:
yarn lint --fixRemember to add Maestro E2E tests for your change when behavior is user-visible. To run the E2E tests with Maestro, use:
yarn test:e2e:ios
yarn test:e2e:android
yarn test:e2e:mobile # both platforms sequentially
yarn test:e2e:ios-native # native iOS example app (CommonMark only)
yarn test:e2e:android-native # native Android example app (CommonMark only)The test script names follow the pattern test:e2e[:<config>]:<platform>[:update-screenshots]:
<platform>—ios,android, ormobile(both sequentially).<config>— optional tag filter. Omitting it runs all tests. Named configs:smoke— quick sanity check covering all basic elements.advanced— extended tests for advanced functionality.
update-screenshots— instead of asserting, refreshes the stored screenshot baselines. Not available for config-filtered runs.
Examples:
yarn test:e2e:smoke:ios # smoke tests on iOS only
yarn test:e2e:smoke:mobile # smoke tests on both platforms
yarn test:e2e:advanced:android # advanced tests on Android onlyIf your change affects visual output, update the screenshot baselines:
yarn test:e2e:ios:update-screenshots
yarn test:e2e:android:update-screenshotsMaestro must be installed and a simulator/emulator must be available. Pass
-- --rebuildto force a fresh build of the example app.
Storybook is embedded in the react-native-example app (apps/react-native-example/) as a dedicated screen. To use it, run the example app normally and navigate to the Storybook screen from the home screen.
Stories live in apps/react-native-example/.rnstorybook/stories/.
We follow the conventional commits specification for our commit messages:
fix: bug fixes, e.g. fix crash due to deprecated method.feat: new features, e.g. add new method to the module.refactor: code refactor, e.g. migrate from class components to hooks.docs: changes into documentation, e.g. add usage example for the module.test: adding or updating tests, e.g. add integration tests using detox.chore: tooling changes, e.g. change CI config.
Our pre-commit hooks verify that your commit message matches this format when committing.
We use TypeScript for type checking and ESLint with Prettier for linting and formatting the code. User-facing behavior is covered by Maestro E2E tests; a smaller Jest suite (yarn test) backs them up for JS-level regressions.
Our pre-commit hooks verify that lint and typecheck pass when committing.
Maintainers can hand a pull request to Argent Cloud, an experimental internal tool that runs an AI agent against a build of apps/react-native-example on a cloud simulator, screenshots every step and reports what it saw. Comment /argent on the pull request, or add the argent: ios label. Each of those is one run: pushing to the branch afterwards does not start another, whatever labels the pull request carries, because a session costs real money. To run it again, comment /argent again, or take the label off and put it back. A pull request from a fork runs only at a commit you have reviewed: /argent <full head SHA>. Both paths need write access to the repository.
Each run posts a comment on the pull request with the agent's report and its screenshots inline under it, and the Slack notification links that comment. The comment is posted by argent-cloud comment as Argent's GitHub App, argent-loop, which has to be installed on this repository with read and write access to contents; the backend hosts the images. It comments only for a caller whose token can push to the repository, which the report job proves with github.token and contents: write. The report is rendered as markdown, as the agent wrote it.
The screenshots (<session-id>-screenshots.tar.gz), that report (output.log) and the agent's turn-by-turn commentary (stream.log) are attached to the run as the argent-cloud-pr-<number> artifact for fourteen days - Argent's own copy expires twelve hours after the session.
Each run spends Anthropic API credit, which is why it is on demand rather than on every pull request.
The CLI is downloaded from software-mansion-labs/argent-cloud-releases by .github/argent-cloud/install-argent-cloud.sh. It always installs the latest release.
The app is built in Release for the simulator (yarn react-native-example build:ios:release, which is also how to reproduce the bundle locally) so the JavaScript is embedded and the agent's simulator needs no Metro server.
What the agent is told lives in .github/argent-cloud/prompt.md. Edit that file to change what gets tested; the workflow around it should not need touching. The pull request's title and body are pasted into the prompt as fenced, clearly labelled untrusted data - keep them that way if you change the template.
We use release-it to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.
To publish new versions, run the following:
yarn releaseThe package.json file contains various scripts for common tasks:
yarn: setup project by installing dependencies.yarn prepare: build the library (required before running any app).yarn typecheck: type-check files with TypeScript.yarn lint: lint files with ESLint.yarn test: run the Jest unit tests of the React Native package.yarn build:wasm: rebuild the md4c WebAssembly parser used by the web build.yarn react-native-example start: start the Metro server for the react-native-example app.yarn react-native-example android: run the react-native-example app on Android.yarn react-native-example ios: run the react-native-example app on iOS.yarn react-native-example build:ios:release: build the react-native-example app in Release for the iOS simulator, with the JS bundle embedded. This is the bundle the Argent Cloud workflow ships.yarn test:e2e:ios: run all E2E tests on iOS simulator.yarn test:e2e:android: run all E2E tests on Android emulator.yarn test:e2e:mobile: run all E2E tests on both platforms sequentially.yarn test:e2e:smoke:ios: run smoke tests on iOS simulator.yarn test:e2e:smoke:android: run smoke tests on Android emulator.yarn test:e2e:smoke:mobile: run smoke tests on both platforms sequentially.yarn test:e2e:advanced:ios: run advanced tests on iOS simulator.yarn test:e2e:advanced:android: run advanced tests on Android emulator.yarn test:e2e:advanced:mobile: run advanced tests on both platforms sequentially.yarn test:e2e:ios:update-screenshots: refresh iOS screenshot baselines.yarn test:e2e:android:update-screenshots: refresh Android screenshot baselines.yarn test:e2e:mobile:update-screenshots: refresh screenshot baselines for both platforms.yarn test:e2e:ios-native: run CommonMark E2E tests on the native iOS example app.yarn test:e2e:ios-native:smoke: smoke CommonMark tests on the native iOS example app.yarn test:e2e:ios-native:update-screenshots: refresh native iOS example screenshot baselines.yarn test:e2e:android-native: run CommonMark E2E tests on the native Android example app.yarn test:e2e:android-native:smoke: smoke CommonMark tests on the native Android example app.yarn test:e2e:android-native:update-screenshots: refresh native Android example screenshot baselines.
Working on your first pull request? You can learn how from this free series: How to Contribute to an Open Source Project on GitHub.
When you're sending a pull request:
- Prefer small pull requests focused on one change.
- Verify that lint and typecheck are passing.
- Review the documentation to make sure it looks good.
- Follow the pull request template when opening a pull request.
- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
Pull requests that are not drafts are reviewed automatically by CodeRabbit, configured in .coderabbit.yaml. Its comments are suggestions, not a merge requirement - reply to them or resolve them as you would a human review. Comment @coderabbitai review to ask for a review again.