### Initial Project Setup Source: https://github.com/software-mansion/enriched-markdown/blob/main/CONTRIBUTING.md Install dependencies and build the library, which is required before running any application. ```sh # Install dependencies yarn # Build the library (required before running any app) yarn prepare ``` -------------------------------- ### Start the Packager Source: https://github.com/software-mansion/enriched-markdown/blob/main/CONTRIBUTING.md Command to start the Metro packager for the example application. ```sh yarn react-native-example start ``` -------------------------------- ### Run Example App on Android Source: https://github.com/software-mansion/enriched-markdown/blob/main/CONTRIBUTING.md Command to run the example application on an Android device or emulator. ```sh yarn react-native-example android ``` -------------------------------- ### Run Example App on iOS Source: https://github.com/software-mansion/enriched-markdown/blob/main/CONTRIBUTING.md Command to run the example application on an iOS device or simulator. ```sh yarn react-native-example ios ``` -------------------------------- ### Maestro Test Examples Source: https://github.com/software-mansion/enriched-markdown/blob/main/CONTRIBUTING.md Examples of running specific Maestro test configurations. ```sh 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 only ``` -------------------------------- ### Install iOS and macOS Dependencies Source: https://github.com/software-mansion/enriched-markdown/blob/main/packages/react-native-enriched-markdown/README.md Commands to install native dependencies after adding the library. ```sh # iOS cd ios && bundle install && bundle exec pod install # macOS (react-native-macos) cd macos && bundle install && bundle exec pod install ``` -------------------------------- ### Configure Jest setup file Source: https://github.com/software-mansion/enriched-markdown/blob/main/docs/TESTING.md Point Jest at the shipped mock from a setup file listed in your config's setupFilesAfterEnv. ```js // jest.setup.js jest.mock('react-native-enriched-markdown', () => require('react-native-enriched-markdown/jest'), ); ``` -------------------------------- ### Install Nightly Build Source: https://github.com/software-mansion/enriched-markdown/blob/main/packages/react-native-enriched-markdown/README.md Command to install the latest features before a stable release. ```sh yarn add react-native-enriched-markdown@nightly ``` -------------------------------- ### Run Expo Prebuild Source: https://github.com/software-mansion/enriched-markdown/blob/main/packages/react-native-enriched-markdown/README.md Rebuild the native app after installing the library in Expo. ```sh npx expo prebuild ``` -------------------------------- ### Install KaTeX dependency Source: https://github.com/software-mansion/enriched-markdown/blob/main/docs/LATEX_MATH.md Commands to install the optional KaTeX peer dependency required for web rendering. ```sh npm install katex # or yarn add katex ``` -------------------------------- ### Install Library in Expo Source: https://github.com/software-mansion/enriched-markdown/blob/main/packages/react-native-enriched-markdown/README.md Use npx expo install to add the library to an Expo project. ```sh npx expo install react-native-enriched-markdown ``` -------------------------------- ### Build and Run Android App Source: https://github.com/software-mansion/enriched-markdown/blob/main/apps/react-native-example/README.md Execute the build command for Android after starting the Metro server. ```sh # Using npm npm run android # OR using Yarn yarn android ``` -------------------------------- ### Start Metro Development Server Source: https://github.com/software-mansion/enriched-markdown/blob/main/apps/react-native-example/README.md Run the Metro JavaScript build tool from the project root to enable development features. ```sh # Using npm npm start # OR using Yarn yarn start ``` -------------------------------- ### Install CocoaPods Dependencies Source: https://github.com/software-mansion/enriched-markdown/blob/main/apps/react-native-example/README.md Commands to set up and install native iOS dependencies using Ruby and CocoaPods. ```sh bundle install ``` ```sh bundle exec pod install ``` -------------------------------- ### Configuring FormatMenuConfig Source: https://github.com/software-mansion/enriched-markdown/blob/main/docs/API_REFERENCE.md Examples showing how to hide specific menu items and how to localize labels for all items in the Format submenu. ```tsx // Hide Spoiler and Link from the Format submenu // Localize every item ``` -------------------------------- ### Configuring Selection Menu Items Source: https://github.com/software-mansion/enriched-markdown/blob/main/docs/API_REFERENCE.md Examples showing how to hide menu items or localize their labels using selectionMenuConfig. ```tsx // Hide both the Format submenu and the Copy as Markdown action // Localize the visible labels ``` -------------------------------- ### Build and Run iOS App Source: https://github.com/software-mansion/enriched-markdown/blob/main/apps/react-native-example/README.md Execute the build command for iOS after ensuring CocoaPods dependencies are installed. ```sh # Using npm npm run ios # OR using Yarn yarn ios ``` -------------------------------- ### Configure EnrichedMarkdownTextInput for Mentions Source: https://github.com/software-mansion/enriched-markdown/blob/main/docs/MENTIONS.md Example setup for EnrichedMarkdownTextInput with mention indicators and custom link styling for different mention types. ```tsx setShowSuggestions(true)} onChangeMention={({ indicator, text }) => setQuery(text)} onEndMention={() => setShowSuggestions(false)} onCaretRectChange={setCaretRect} // for positioning the popup /> ``` -------------------------------- ### Install React Native Package Source: https://github.com/software-mansion/enriched-markdown/blob/main/README.md Use yarn to add the react-native-enriched-markdown package to your project. ```bash yarn add react-native-enriched-markdown ``` -------------------------------- ### Verify New Architecture Logs Source: https://github.com/software-mansion/enriched-markdown/blob/main/CONTRIBUTING.md Example log output from Metro indicating the app is running with the new architecture enabled. ```json Running "EnrichedMarkdownExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1} ``` -------------------------------- ### Superscript and Subscript Markdown Source: https://github.com/software-mansion/enriched-markdown/blob/main/docs/ELEMENTS_STRUCTURE.md Examples of superscript and subscript syntax, including mixed usage. ```markdown E = mc^2^ H~2~O H~2~SO~4~ ^14^C dating (isotope notation) H~3~O^+^ (mixed superscript and subscript) ``` -------------------------------- ### Configure writingDirection for EnrichedMarkdown Source: https://github.com/software-mansion/enriched-markdown/blob/main/docs/API_REFERENCE.md Examples showing how to handle mixed-direction text using the default 'first-strong' behavior and how to force RTL direction for all paragraphs. ```tsx // Mixed-direction document — each paragraph picks its own side. // Force RTL on every paragraph regardless of content. ``` -------------------------------- ### Adding Custom Context Menu Items Source: https://github.com/software-mansion/enriched-markdown/blob/main/docs/API_REFERENCE.md Example of adding a custom 'Summarize with AI' action to the EnrichedMarkdownTextInput component. ```tsx { console.log('Selected:', text, 'Bold:', styleState.bold.isActive); }, }, ]} /> ``` -------------------------------- ### Implement EnrichedMarkdownTextInput with Bold Toggle Source: https://github.com/software-mansion/enriched-markdown/blob/main/docs/INPUT.md This example demonstrates using a ref to imperatively toggle bold styling and the onChangeState callback to track the active style state for UI updates. ```tsx import { useRef, useState } from 'react'; import { View, Button, StyleSheet } from 'react-native'; import { EnrichedMarkdownTextInput, type EnrichedMarkdownTextInputInstance, type StyleState, } from 'react-native-enriched-markdown'; export default function App() { const ref = useRef(null); const [state, setState] = useState(null); return (