@codearcade/expo-markdown-native 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "ExpoMarkdownNativeMarkdown"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => min_ios_version_supported }
14
+ s.source = { :git => "https://github.com/codearcade-io/expo-markdown-native.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
17
+ s.private_header_files = "ios/**/*.h"
18
+
19
+ install_modules_dependencies(s)
20
+ end
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abhishek Singh
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # @codearcade/expo-markdown-native-markdown
2
+
3
+ Native Markdown rendering for Expo & React Native with built-in syntax highlighting.
4
+
5
+ ## Installation
6
+
7
+
8
+ ```sh
9
+ npm install @codearcade/expo-markdown-native-markdown
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+
16
+ ```js
17
+ import { ExpoMarkdownNativeMarkdownView } from "@codearcade/expo-markdown-native-markdown";
18
+
19
+ // ...
20
+
21
+ <ExpoMarkdownNativeMarkdownView color="tomato" />
22
+ ```
23
+
24
+
25
+ ## Contributing
26
+
27
+ - [Development workflow](CONTRIBUTING.md#development-workflow)
28
+ - [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
29
+ - [Code of conduct](CODE_OF_CONDUCT.md)
30
+
31
+ ## License
32
+
33
+ MIT
34
+
35
+ ---
36
+
37
+ Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -0,0 +1,67 @@
1
+ buildscript {
2
+ ext.ExpoMarkdownNativeMarkdown = [
3
+ kotlinVersion: "2.0.21",
4
+ minSdkVersion: 24,
5
+ compileSdkVersion: 36,
6
+ targetSdkVersion: 36
7
+ ]
8
+
9
+ ext.getExtOrDefault = { prop ->
10
+ if (rootProject.ext.has(prop)) {
11
+ return rootProject.ext.get(prop)
12
+ }
13
+
14
+ return ExpoMarkdownNativeMarkdown[prop]
15
+ }
16
+
17
+ repositories {
18
+ google()
19
+ mavenCentral()
20
+ }
21
+
22
+ dependencies {
23
+ classpath "com.android.tools.build:gradle:8.7.2"
24
+ // noinspection DifferentKotlinGradleVersion
25
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
26
+ }
27
+ }
28
+
29
+
30
+ apply plugin: "com.android.library"
31
+ apply plugin: "kotlin-android"
32
+
33
+ apply plugin: "com.facebook.react"
34
+
35
+ android {
36
+ namespace "com.codearcade.expomarkdownnativemarkdown"
37
+
38
+ compileSdkVersion getExtOrDefault("compileSdkVersion")
39
+
40
+ defaultConfig {
41
+ minSdkVersion getExtOrDefault("minSdkVersion")
42
+ targetSdkVersion getExtOrDefault("targetSdkVersion")
43
+ }
44
+
45
+ buildFeatures {
46
+ buildConfig true
47
+ }
48
+
49
+ buildTypes {
50
+ release {
51
+ minifyEnabled false
52
+ }
53
+ }
54
+
55
+ lint {
56
+ disable "GradleCompatible"
57
+ }
58
+
59
+ compileOptions {
60
+ sourceCompatibility JavaVersion.VERSION_1_8
61
+ targetCompatibility JavaVersion.VERSION_1_8
62
+ }
63
+ }
64
+
65
+ dependencies {
66
+ implementation "com.facebook.react:react-android"
67
+ }
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,17 @@
1
+ package com.codearcade.expomarkdownnativemarkdown
2
+
3
+ import com.facebook.react.BaseReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfoProvider
7
+ import com.facebook.react.uimanager.ViewManager
8
+
9
+ class ExpoMarkdownNativeMarkdownViewPackage : BaseReactPackage() {
10
+ override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
11
+ return listOf(ExpoMarkdownNativeMarkdownViewManager())
12
+ }
13
+
14
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? = null
15
+
16
+ override fun getReactModuleInfoProvider() = ReactModuleInfoProvider { emptyMap() }
17
+ }
@@ -0,0 +1,15 @@
1
+ package com.codearcade.expomarkdownnativemarkdown
2
+
3
+ import android.content.Context
4
+ import android.util.AttributeSet
5
+ import android.view.View
6
+
7
+ class ExpoMarkdownNativeMarkdownView : View {
8
+ constructor(context: Context?) : super(context)
9
+ constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
10
+ constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
11
+ context,
12
+ attrs,
13
+ defStyleAttr
14
+ )
15
+ }
@@ -0,0 +1,41 @@
1
+ package com.codearcade.expomarkdownnativemarkdown
2
+
3
+ import android.graphics.Color
4
+ import com.facebook.react.module.annotations.ReactModule
5
+ import com.facebook.react.uimanager.SimpleViewManager
6
+ import com.facebook.react.uimanager.ThemedReactContext
7
+ import com.facebook.react.uimanager.ViewManagerDelegate
8
+ import com.facebook.react.uimanager.annotations.ReactProp
9
+ import com.facebook.react.viewmanagers.ExpoMarkdownNativeMarkdownViewManagerInterface
10
+ import com.facebook.react.viewmanagers.ExpoMarkdownNativeMarkdownViewManagerDelegate
11
+
12
+ @ReactModule(name = ExpoMarkdownNativeMarkdownViewManager.NAME)
13
+ class ExpoMarkdownNativeMarkdownViewManager : SimpleViewManager<ExpoMarkdownNativeMarkdownView>(),
14
+ ExpoMarkdownNativeMarkdownViewManagerInterface<ExpoMarkdownNativeMarkdownView> {
15
+ private val mDelegate: ViewManagerDelegate<ExpoMarkdownNativeMarkdownView>
16
+
17
+ init {
18
+ mDelegate = ExpoMarkdownNativeMarkdownViewManagerDelegate(this)
19
+ }
20
+
21
+ override fun getDelegate(): ViewManagerDelegate<ExpoMarkdownNativeMarkdownView>? {
22
+ return mDelegate
23
+ }
24
+
25
+ override fun getName(): String {
26
+ return NAME
27
+ }
28
+
29
+ public override fun createViewInstance(context: ThemedReactContext): ExpoMarkdownNativeMarkdownView {
30
+ return ExpoMarkdownNativeMarkdownView(context)
31
+ }
32
+
33
+ @ReactProp(name = "color")
34
+ override fun setColor(view: ExpoMarkdownNativeMarkdownView?, color: Int?) {
35
+ view?.setBackgroundColor(color ?: Color.TRANSPARENT)
36
+ }
37
+
38
+ companion object {
39
+ const val NAME = "ExpoMarkdownNativeMarkdownView"
40
+ }
41
+ }
@@ -0,0 +1,14 @@
1
+ #import <React/RCTViewComponentView.h>
2
+ #import <UIKit/UIKit.h>
3
+
4
+ #ifndef ExpoMarkdownNativeMarkdownViewNativeComponent_h
5
+ #define ExpoMarkdownNativeMarkdownViewNativeComponent_h
6
+
7
+ NS_ASSUME_NONNULL_BEGIN
8
+
9
+ @interface ExpoMarkdownNativeMarkdownView : RCTViewComponentView
10
+ @end
11
+
12
+ NS_ASSUME_NONNULL_END
13
+
14
+ #endif /* ExpoMarkdownNativeMarkdownViewNativeComponent_h */
@@ -0,0 +1,48 @@
1
+ #import "ExpoMarkdownNativeMarkdownView.h"
2
+
3
+ #import <React/RCTConversions.h>
4
+
5
+ #import <react/renderer/components/ExpoMarkdownNativeMarkdownViewSpec/ComponentDescriptors.h>
6
+ #import <react/renderer/components/ExpoMarkdownNativeMarkdownViewSpec/Props.h>
7
+ #import <react/renderer/components/ExpoMarkdownNativeMarkdownViewSpec/RCTComponentViewHelpers.h>
8
+
9
+ #import "RCTFabricComponentsPlugins.h"
10
+
11
+ using namespace facebook::react;
12
+
13
+ @implementation ExpoMarkdownNativeMarkdownView {
14
+ UIView * _view;
15
+ }
16
+
17
+ + (ComponentDescriptorProvider)componentDescriptorProvider
18
+ {
19
+ return concreteComponentDescriptorProvider<ExpoMarkdownNativeMarkdownViewComponentDescriptor>();
20
+ }
21
+
22
+ - (instancetype)initWithFrame:(CGRect)frame
23
+ {
24
+ if (self = [super initWithFrame:frame]) {
25
+ static const auto defaultProps = std::make_shared<const ExpoMarkdownNativeMarkdownViewProps>();
26
+ _props = defaultProps;
27
+
28
+ _view = [[UIView alloc] init];
29
+
30
+ self.contentView = _view;
31
+ }
32
+
33
+ return self;
34
+ }
35
+
36
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
37
+ {
38
+ const auto &oldViewProps = *std::static_pointer_cast<ExpoMarkdownNativeMarkdownViewProps const>(_props);
39
+ const auto &newViewProps = *std::static_pointer_cast<ExpoMarkdownNativeMarkdownViewProps const>(props);
40
+
41
+ if (oldViewProps.color != newViewProps.color) {
42
+ [_view setBackgroundColor: RCTUIColorFromSharedColor(newViewProps.color)];
43
+ }
44
+
45
+ [super updateProps:props oldProps:oldProps];
46
+ }
47
+
48
+ @end
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export * from "./markdown.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA,cAAc,eAAY","ignoreList":[]}
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+
3
+ import React, { memo, useMemo, useState } from 'react';
4
+ import { Platform, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
5
+ import CodeHighlighter from 'react-native-code-highlighter';
6
+ import MarkdownDisplay from 'react-native-markdown-display';
7
+ import { github, monokai } from 'react-syntax-highlighter/dist/esm/styles/hljs';
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ export const Markdown = ({
10
+ content,
11
+ theme = 'light',
12
+ codeTheme,
13
+ styles = {},
14
+ codeContainerStyle,
15
+ onLinkPress,
16
+ codeFontSize = 13,
17
+ onCopy
18
+ }) => {
19
+ // 1. Select default Syntax Theme
20
+ const activeCodeTheme = codeTheme || (theme === 'dark' ? monokai : github);
21
+
22
+ // 2. Define Custom Rules
23
+ const rules = useMemo(() => ({
24
+ fence: (node, _children, _parent, _style) => {
25
+ const fenceNode = node;
26
+ return /*#__PURE__*/_jsx(CodeBlock, {
27
+ content: node.content,
28
+ language: fenceNode.sourceInfo,
29
+ syntaxTheme: activeCodeTheme,
30
+ appTheme: theme,
31
+ codeFontSize: codeFontSize,
32
+ codeContainerStyle: codeContainerStyle,
33
+ onCopy: onCopy
34
+ }, node.key);
35
+ },
36
+ code_block: (node, _children, _parent, _style) => /*#__PURE__*/_jsx(CodeBlock, {
37
+ content: node.content,
38
+ language: null,
39
+ syntaxTheme: activeCodeTheme,
40
+ appTheme: theme,
41
+ codeFontSize: codeFontSize,
42
+ codeContainerStyle: codeContainerStyle,
43
+ onCopy: onCopy
44
+ }, node.key)
45
+ }), [activeCodeTheme, theme, codeFontSize, onCopy]);
46
+ const baseStyles = theme === 'dark' ? markdownDark : markdownLight;
47
+ const mergedStyles = useMemo(() => {
48
+ const result = {
49
+ ...baseStyles
50
+ };
51
+ for (const key in styles) {
52
+ const userStyle = styles[key];
53
+ if (userStyle && typeof userStyle === 'object' && !Array.isArray(userStyle)) {
54
+ // If it's a style object, merge it with the base (or empty object if base doesn't exist)
55
+ result[key] = {
56
+ ...(result[key] || {}),
57
+ ...userStyle
58
+ };
59
+ } else {
60
+ // If it's not an object (rare edge case) or null/undefined, just overwrite/set it
61
+ result[key] = userStyle;
62
+ }
63
+ }
64
+ return result;
65
+ }, [baseStyles, styles]);
66
+ return /*#__PURE__*/_jsx(MarkdownDisplay, {
67
+ style: mergedStyles,
68
+ rules: rules,
69
+ onLinkPress: onLinkPress,
70
+ children: content
71
+ });
72
+ };
73
+ // --- Sub-Component: Code Block ---
74
+ const CodeBlock = /*#__PURE__*/memo(({
75
+ content,
76
+ language,
77
+ syntaxTheme,
78
+ appTheme,
79
+ codeFontSize,
80
+ codeContainerStyle,
81
+ onCopy
82
+ }) => {
83
+ const [copied, setCopied] = useState(false);
84
+ const handleCopy = async () => {
85
+ if (!onCopy) return;
86
+ try {
87
+ const textToCopy = content.replace(/\n$/, '');
88
+ await onCopy(textToCopy);
89
+ setCopied(true);
90
+ setTimeout(() => setCopied(false), 2000);
91
+ } catch (e) {
92
+ console.warn('[Markdown] Copy failed', e);
93
+ }
94
+ };
95
+
96
+ // Dynamic Styles based on theme
97
+ const isDark = appTheme === 'dark';
98
+ const containerBg = isDark ? '#2d2d2d' : '#f5f5f5';
99
+ const borderColor = isDark ? 'rgba(255,255,255,0.1)' : '#e0e0e0';
100
+ const headerBg = isDark ? 'rgba(255,255,255,0.05)' : '#eaeaea';
101
+ const textColor = isDark ? '#fff' : '#333';
102
+ const codeStyle = useMemo(() => ({
103
+ ...staticStyles.codeText,
104
+ fontSize: codeFontSize
105
+ }), [codeFontSize]);
106
+ return /*#__PURE__*/_jsxs(View, {
107
+ style: [staticStyles.codeContainer, {
108
+ backgroundColor: containerBg,
109
+ borderColor
110
+ }, codeContainerStyle],
111
+ children: [/*#__PURE__*/_jsxs(View, {
112
+ style: [staticStyles.codeHeader, {
113
+ backgroundColor: headerBg,
114
+ borderBottomColor: borderColor
115
+ }],
116
+ children: [/*#__PURE__*/_jsx(Text, {
117
+ style: staticStyles.languageLabel,
118
+ children: language || 'Code'
119
+ }), onCopy && /*#__PURE__*/_jsx(TouchableOpacity, {
120
+ onPress: handleCopy,
121
+ style: staticStyles.copyButton,
122
+ children: /*#__PURE__*/_jsx(Text, {
123
+ style: [staticStyles.copyText, {
124
+ color: textColor
125
+ }],
126
+ children: copied ? 'Copied!' : 'Copy'
127
+ })
128
+ })]
129
+ }), /*#__PURE__*/_jsx(CodeHighlighter, {
130
+ language: language ?? undefined,
131
+ hljsStyle: syntaxTheme,
132
+ textStyle: codeStyle,
133
+ children: content
134
+ })]
135
+ });
136
+ });
137
+ const staticStyles = StyleSheet.create({
138
+ codeContainer: {
139
+ marginVertical: 10,
140
+ borderRadius: 8,
141
+ overflow: 'hidden',
142
+ borderWidth: 1
143
+ },
144
+ codeHeader: {
145
+ flexDirection: 'row',
146
+ justifyContent: 'space-between',
147
+ alignItems: 'center',
148
+ paddingHorizontal: 12,
149
+ paddingVertical: 6,
150
+ borderBottomWidth: 1
151
+ },
152
+ languageLabel: {
153
+ color: '#888',
154
+ fontSize: 11,
155
+ fontWeight: '600',
156
+ textTransform: 'uppercase'
157
+ },
158
+ copyButton: {
159
+ padding: 4
160
+ },
161
+ copyText: {
162
+ fontSize: 11,
163
+ fontWeight: '600'
164
+ },
165
+ codeText: {
166
+ fontFamily: Platform.select({
167
+ ios: 'Menlo',
168
+ android: 'monospace',
169
+ default: 'monospace'
170
+ }),
171
+ lineHeight: 20
172
+ }
173
+ });
174
+ const markdownLight = {
175
+ body: {
176
+ color: '#222',
177
+ fontSize: 16,
178
+ lineHeight: 24
179
+ },
180
+ heading1: {
181
+ color: '#000',
182
+ fontSize: 28,
183
+ fontWeight: '700',
184
+ marginVertical: 10
185
+ },
186
+ code_inline: {
187
+ backgroundColor: '#f0f0f0',
188
+ color: '#e01e5a',
189
+ borderRadius: 4
190
+ }
191
+ };
192
+ const markdownDark = {
193
+ body: {
194
+ color: '#eee',
195
+ fontSize: 16,
196
+ lineHeight: 24
197
+ },
198
+ heading1: {
199
+ color: '#fff',
200
+ fontSize: 28,
201
+ fontWeight: '700',
202
+ marginVertical: 10
203
+ },
204
+ code_inline: {
205
+ backgroundColor: '#333',
206
+ color: '#ff7b72',
207
+ borderRadius: 4
208
+ },
209
+ blockquote: {
210
+ borderLeftColor: '#555',
211
+ backgroundColor: '#222',
212
+ color: '#aaa'
213
+ }
214
+ };
215
+ //# sourceMappingURL=markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","memo","useMemo","useState","Platform","StyleSheet","Text","TouchableOpacity","View","CodeHighlighter","MarkdownDisplay","github","monokai","jsx","_jsx","jsxs","_jsxs","Markdown","content","theme","codeTheme","styles","codeContainerStyle","onLinkPress","codeFontSize","onCopy","activeCodeTheme","rules","fence","node","_children","_parent","_style","fenceNode","CodeBlock","language","sourceInfo","syntaxTheme","appTheme","key","code_block","baseStyles","markdownDark","markdownLight","mergedStyles","result","userStyle","Array","isArray","style","children","copied","setCopied","handleCopy","textToCopy","replace","setTimeout","e","console","warn","isDark","containerBg","borderColor","headerBg","textColor","codeStyle","staticStyles","codeText","fontSize","codeContainer","backgroundColor","codeHeader","borderBottomColor","languageLabel","onPress","copyButton","copyText","color","undefined","hljsStyle","textStyle","create","marginVertical","borderRadius","overflow","borderWidth","flexDirection","justifyContent","alignItems","paddingHorizontal","paddingVertical","borderBottomWidth","fontWeight","textTransform","padding","fontFamily","select","ios","android","default","lineHeight","body","heading1","code_inline","blockquote","borderLeftColor"],"sourceRoot":"..\\..\\src","sources":["markdown.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,IAA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0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
3
+ import type { ReactStyle } from 'react-native-code-highlighter';
4
+ interface Props {
5
+ content: string;
6
+ theme?: 'light' | 'dark';
7
+ codeTheme?: ReactStyle;
8
+ styles?: Record<string, StyleProp<ViewStyle | TextStyle>>;
9
+ codeContainerStyle?: StyleProp<ViewStyle>;
10
+ codeFontSize?: number;
11
+ onLinkPress?: (url: string) => boolean;
12
+ onCopy?: (text: string) => Promise<void> | void;
13
+ }
14
+ export declare const Markdown: React.FC<Props>;
15
+ export {};
16
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/markdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAMhE,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC;IAC1D,kBAAkB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACjD;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAsFpC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,128 @@
1
+ {
2
+ "name": "@codearcade/expo-markdown-native",
3
+ "version": "1.0.0",
4
+ "description": "Native Markdown rendering for Expo & React Native with built-in syntax highlighting.",
5
+ "main": "./lib/module/index.js",
6
+ "private": false,
7
+ "types": "./lib/typescript/src/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "source": "./src/index.tsx",
11
+ "types": "./lib/typescript/src/index.d.ts",
12
+ "default": "./lib/module/index.js"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "files": [
17
+ "src",
18
+ "lib",
19
+ "android",
20
+ "ios",
21
+ "cpp",
22
+ "*.podspec",
23
+ "react-native.config.js",
24
+ "!ios/build",
25
+ "!android/build",
26
+ "!android/gradle",
27
+ "!android/gradlew",
28
+ "!android/gradlew.bat",
29
+ "!android/local.properties",
30
+ "!**/__tests__",
31
+ "!**/__fixtures__",
32
+ "!**/__mocks__",
33
+ "!**/.*"
34
+ ],
35
+ "scripts": {
36
+ "example": "yarn workspace @codearcade/expo-markdown-native-example",
37
+ "clean": "del-cli lib",
38
+ "prepare": "bob build",
39
+ "typecheck": "tsc",
40
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
41
+ "release": "npm publish --access public"
42
+ },
43
+ "keywords": [
44
+ "react-native",
45
+ "ios",
46
+ "android"
47
+ ],
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/codearcade-io/expo-markdown-native.git"
51
+ },
52
+ "author": "Abhishek Singh <official.6packprogrammer@gmail.com> (https://github.com/meabhisingh)",
53
+ "license": "MIT",
54
+ "bugs": {
55
+ "url": "https://github.com/codearcade-io/expo-markdown-native/issues"
56
+ },
57
+ "homepage": "https://github.com/codearcade-io/expo-markdown-native#readme",
58
+ "publishConfig": {
59
+ "registry": "https://registry.npmjs.org/"
60
+ },
61
+ "devDependencies": {
62
+ "@eslint/compat": "^1.3.2",
63
+ "@eslint/eslintrc": "^3.3.1",
64
+ "@eslint/js": "^9.35.0",
65
+ "@react-native/babel-preset": "0.83.0",
66
+ "@react-native/eslint-config": "0.83.0",
67
+ "@types/react": "^19.1.12",
68
+ "@types/react-syntax-highlighter": "^15.5.13",
69
+ "del-cli": "^6.0.0",
70
+ "eslint": "^9.35.0",
71
+ "eslint-config-prettier": "^10.1.8",
72
+ "eslint-plugin-prettier": "^5.5.4",
73
+ "prettier": "^2.8.8",
74
+ "react": "19.1.0",
75
+ "react-native": "0.81.5",
76
+ "react-native-builder-bob": "^0.40.13",
77
+ "react-native-code-highlighter": "^1.3.0",
78
+ "react-native-markdown-display": "^7.0.2",
79
+ "react-syntax-highlighter": "^16.1.0",
80
+ "turbo": "^2.5.6",
81
+ "typescript": "^5.9.2"
82
+ },
83
+ "peerDependencies": {
84
+ "react": "*",
85
+ "react-native": "*",
86
+ "react-native-code-highlighter": "*",
87
+ "react-native-markdown-display": "*",
88
+ "react-native-svg": "*",
89
+ "react-syntax-highlighter": "*"
90
+ },
91
+ "workspaces": [
92
+ "example"
93
+ ],
94
+ "packageManager": "yarn@4.11.0",
95
+ "react-native-builder-bob": {
96
+ "source": "src",
97
+ "output": "lib",
98
+ "targets": [
99
+ [
100
+ "module",
101
+ {
102
+ "esm": true
103
+ }
104
+ ],
105
+ [
106
+ "typescript",
107
+ {
108
+ "project": "tsconfig.build.json"
109
+ }
110
+ ]
111
+ ]
112
+ },
113
+ "prettier": {
114
+ "quoteProps": "consistent",
115
+ "singleQuote": true,
116
+ "tabWidth": 2,
117
+ "trailingComma": "es5",
118
+ "useTabs": false
119
+ },
120
+ "create-react-native-library": {
121
+ "type": "library",
122
+ "languages": "js",
123
+ "tools": [
124
+ "eslint"
125
+ ],
126
+ "version": "0.57.0"
127
+ }
128
+ }
package/src/index.tsx ADDED
@@ -0,0 +1 @@
1
+ export * from './markdown';
@@ -0,0 +1,273 @@
1
+ import React, { memo, useMemo, useState } from 'react';
2
+ import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
3
+ import {
4
+ Platform,
5
+ StyleSheet,
6
+ Text,
7
+ TouchableOpacity,
8
+ View,
9
+ } from 'react-native';
10
+ import type { ReactStyle } from 'react-native-code-highlighter';
11
+ import CodeHighlighter from 'react-native-code-highlighter';
12
+ import type { ASTNode } from 'react-native-markdown-display';
13
+ import MarkdownDisplay from 'react-native-markdown-display';
14
+ import { github, monokai } from 'react-syntax-highlighter/dist/esm/styles/hljs';
15
+
16
+ interface Props {
17
+ content: string;
18
+ theme?: 'light' | 'dark';
19
+ codeTheme?: ReactStyle;
20
+ styles?: Record<string, StyleProp<ViewStyle | TextStyle>>;
21
+ codeContainerStyle?: StyleProp<ViewStyle>;
22
+ codeFontSize?: number;
23
+ onLinkPress?: (url: string) => boolean;
24
+ onCopy?: (text: string) => Promise<void> | void;
25
+ }
26
+
27
+ export const Markdown: React.FC<Props> = ({
28
+ content,
29
+ theme = 'light',
30
+ codeTheme,
31
+ styles = {},
32
+ codeContainerStyle,
33
+ onLinkPress,
34
+ codeFontSize = 13,
35
+ onCopy,
36
+ }) => {
37
+ // 1. Select default Syntax Theme
38
+ const activeCodeTheme = codeTheme || (theme === 'dark' ? monokai : github);
39
+
40
+ // 2. Define Custom Rules
41
+ const rules = useMemo(
42
+ () => ({
43
+ fence: (node: ASTNode, _children: any, _parent: any, _style: any) => {
44
+ const fenceNode = node as ASTNode & { sourceInfo: string };
45
+
46
+ return (
47
+ <CodeBlock
48
+ key={node.key}
49
+ content={node.content}
50
+ language={fenceNode.sourceInfo}
51
+ syntaxTheme={activeCodeTheme}
52
+ appTheme={theme}
53
+ codeFontSize={codeFontSize}
54
+ codeContainerStyle={codeContainerStyle}
55
+ onCopy={onCopy}
56
+ />
57
+ );
58
+ },
59
+ code_block: (
60
+ node: ASTNode,
61
+ _children: any,
62
+ _parent: any,
63
+ _style: any
64
+ ) => (
65
+ <CodeBlock
66
+ key={node.key}
67
+ content={node.content}
68
+ language={null}
69
+ syntaxTheme={activeCodeTheme}
70
+ appTheme={theme}
71
+ codeFontSize={codeFontSize}
72
+ codeContainerStyle={codeContainerStyle}
73
+ onCopy={onCopy}
74
+ />
75
+ ),
76
+ }),
77
+ [activeCodeTheme, theme, codeFontSize, onCopy]
78
+ );
79
+
80
+ const baseStyles = theme === 'dark' ? markdownDark : markdownLight;
81
+
82
+ const mergedStyles = useMemo(() => {
83
+ const result: Record<string, any> = { ...baseStyles };
84
+
85
+ for (const key in styles) {
86
+ const userStyle = styles[key];
87
+
88
+ if (
89
+ userStyle &&
90
+ typeof userStyle === 'object' &&
91
+ !Array.isArray(userStyle)
92
+ ) {
93
+ // If it's a style object, merge it with the base (or empty object if base doesn't exist)
94
+ result[key] = { ...(result[key] || {}), ...userStyle };
95
+ } else {
96
+ // If it's not an object (rare edge case) or null/undefined, just overwrite/set it
97
+ result[key] = userStyle;
98
+ }
99
+ }
100
+
101
+ return result;
102
+ }, [baseStyles, styles]);
103
+
104
+ return (
105
+ <MarkdownDisplay
106
+ style={mergedStyles}
107
+ rules={rules}
108
+ onLinkPress={onLinkPress}
109
+ >
110
+ {content}
111
+ </MarkdownDisplay>
112
+ );
113
+ };
114
+
115
+ interface CodeBlockProps {
116
+ content: string;
117
+ language?: string | null;
118
+ syntaxTheme: ReactStyle;
119
+ codeContainerStyle?: StyleProp<ViewStyle>;
120
+ appTheme: 'light' | 'dark';
121
+ codeFontSize: number;
122
+ onCopy?: (text: string) => Promise<void> | void;
123
+ }
124
+
125
+ // --- Sub-Component: Code Block ---
126
+ const CodeBlock = memo(
127
+ ({
128
+ content,
129
+ language,
130
+ syntaxTheme,
131
+ appTheme,
132
+ codeFontSize,
133
+ codeContainerStyle,
134
+ onCopy,
135
+ }: CodeBlockProps) => {
136
+ const [copied, setCopied] = useState(false);
137
+
138
+ const handleCopy = async () => {
139
+ if (!onCopy) return;
140
+
141
+ try {
142
+ const textToCopy = content.replace(/\n$/, '');
143
+ await onCopy(textToCopy);
144
+ setCopied(true);
145
+ setTimeout(() => setCopied(false), 2000);
146
+ } catch (e) {
147
+ console.warn('[Markdown] Copy failed', e);
148
+ }
149
+ };
150
+
151
+ // Dynamic Styles based on theme
152
+ const isDark = appTheme === 'dark';
153
+ const containerBg = isDark ? '#2d2d2d' : '#f5f5f5';
154
+ const borderColor = isDark ? 'rgba(255,255,255,0.1)' : '#e0e0e0';
155
+ const headerBg = isDark ? 'rgba(255,255,255,0.05)' : '#eaeaea';
156
+ const textColor = isDark ? '#fff' : '#333';
157
+
158
+ const codeStyle = useMemo(
159
+ () => ({
160
+ ...staticStyles.codeText,
161
+ fontSize: codeFontSize,
162
+ }),
163
+ [codeFontSize]
164
+ );
165
+
166
+ return (
167
+ <View
168
+ style={[
169
+ staticStyles.codeContainer,
170
+ { backgroundColor: containerBg, borderColor },
171
+ codeContainerStyle,
172
+ ]}
173
+ >
174
+ <View
175
+ style={[
176
+ staticStyles.codeHeader,
177
+ { backgroundColor: headerBg, borderBottomColor: borderColor },
178
+ ]}
179
+ >
180
+ <Text style={staticStyles.languageLabel}>{language || 'Code'}</Text>
181
+
182
+ {onCopy && (
183
+ <TouchableOpacity
184
+ onPress={handleCopy}
185
+ style={staticStyles.copyButton}
186
+ >
187
+ <Text style={[staticStyles.copyText, { color: textColor }]}>
188
+ {copied ? 'Copied!' : 'Copy'}
189
+ </Text>
190
+ </TouchableOpacity>
191
+ )}
192
+ </View>
193
+
194
+ <CodeHighlighter
195
+ language={language ?? undefined}
196
+ hljsStyle={syntaxTheme}
197
+ textStyle={codeStyle}
198
+ >
199
+ {content}
200
+ </CodeHighlighter>
201
+ </View>
202
+ );
203
+ }
204
+ );
205
+
206
+ const staticStyles = StyleSheet.create({
207
+ codeContainer: {
208
+ marginVertical: 10,
209
+ borderRadius: 8,
210
+ overflow: 'hidden',
211
+ borderWidth: 1,
212
+ },
213
+ codeHeader: {
214
+ flexDirection: 'row',
215
+ justifyContent: 'space-between',
216
+ alignItems: 'center',
217
+ paddingHorizontal: 12,
218
+ paddingVertical: 6,
219
+ borderBottomWidth: 1,
220
+ },
221
+ languageLabel: {
222
+ color: '#888',
223
+ fontSize: 11,
224
+ fontWeight: '600',
225
+ textTransform: 'uppercase',
226
+ },
227
+ copyButton: {
228
+ padding: 4,
229
+ },
230
+ copyText: {
231
+ fontSize: 11,
232
+ fontWeight: '600',
233
+ },
234
+ codeText: {
235
+ fontFamily: Platform.select({
236
+ ios: 'Menlo',
237
+ android: 'monospace',
238
+ default: 'monospace',
239
+ }),
240
+ lineHeight: 20,
241
+ },
242
+ });
243
+
244
+ const markdownLight = {
245
+ body: { color: '#222', fontSize: 16, lineHeight: 24 },
246
+ heading1: {
247
+ color: '#000',
248
+ fontSize: 28,
249
+ fontWeight: '700',
250
+ marginVertical: 10,
251
+ },
252
+ code_inline: {
253
+ backgroundColor: '#f0f0f0',
254
+ color: '#e01e5a',
255
+ borderRadius: 4,
256
+ },
257
+ };
258
+
259
+ const markdownDark = {
260
+ body: { color: '#eee', fontSize: 16, lineHeight: 24 },
261
+ heading1: {
262
+ color: '#fff',
263
+ fontSize: 28,
264
+ fontWeight: '700',
265
+ marginVertical: 10,
266
+ },
267
+ code_inline: { backgroundColor: '#333', color: '#ff7b72', borderRadius: 4 },
268
+ blockquote: {
269
+ borderLeftColor: '#555',
270
+ backgroundColor: '#222',
271
+ color: '#aaa',
272
+ },
273
+ };