Skip to content

Releases: mientjan/react-native-markdown-renderer

v4.1.0

15 Mar 21:03

Choose a tag to compare

New Features

  • onLinkPress prop — custom link press handler, falls back to Linking.openURL()
  • mergeStyle prop (default true) — deep-merge custom styles with defaults per key instead of replacing entire style objects
  • debugPrintTree prop — log the AST tree structure to console for debugging
  • maxTopLevelChildren + topLevelMaxExceededItem props — preview mode to limit rendered top-level children
  • allowedImageHandlers + defaultImageHandler props — validate image URL schemes before rendering
  • Image accessibilityaccessibilityLabel and accessible set from image alt text

Bug Fixes

  • Hardbreak renders as <Text>{'\n'}</Text> instead of <View> — fixes crash on Android when hardbreak is inside a Text node
  • Code block and fence rules trim trailing newline added by markdown-it parser
  • Ordered list respects the start attribute (e.g. 57. foo now renders as 57 instead of 1)

Internal

  • RenderFunction type extended with ...args: unknown[] rest parameter for backward-compatible extra arguments
  • New AstRendererOptions interface for renderer configuration
  • AstRenderer constructor accepts optional third options argument
  • 41 new unit tests (140 total across 17 suites)

Full Changelog: v4.0.0...v4.1.0

v4.0.0

17 Feb 13:41

Choose a tag to compare

Breaking Changes

  • Minimum React 18.0.0 (was 16.2.0)
  • Minimum React Native 0.73.0 (was 0.50.4)
  • react-native-fit-image removed - The default image render rule now uses React Native's built-in <Image> component. Users who need auto-sizing image behavior should provide a custom image render rule.
  • prop-types removed - Runtime prop validation is no longer performed. Use TypeScript for type checking.
  • Class component replaced with function component - <Markdown> is now a function component using hooks. Code relying on class instance methods or refs will break.
  • markdown-it upgraded from ^8 to ^14 - Custom markdown-it plugins should verify compatibility.
  • Package entry points changed - main now points to lib/commonjs/index.js, module to lib/module/index.js, types to lib/typescript/index.d.ts.

New Features

  • Full TypeScript source with auto-generated type declarations
  • Exported types: ASTNode, RenderFunction, RenderRules, MarkdownStyles, MarkdownProps
  • ESM module output via react-native-builder-bob
  • Proper memoization using useMemo hooks for better rendering performance

Improvements

  • All source converted from JavaScript to TypeScript
  • Deprecated componentWillMount and componentWillReceiveProps replaced with hooks
  • Broken PropTypes import from react removed in AstRenderer
  • Unused React and View imports removed from parser
  • ESLint + Prettier configured
  • Jest test suite with 99 tests across 17 suites
  • Integration snapshot tests for comprehensive markdown rendering

Removed

  • react-native-fit-image dependency
  • prop-types dependency
  • chokidar and fs-extra dev dependencies
  • bin/ build scripts (replaced by react-native-builder-bob)
  • export.json debug artifact
  • Hand-written index.d.ts (replaced by auto-generated types)
  • .npmignore (replaced by files field in package.json)

v3.2.8

18 Jun 14:37

Choose a tag to compare

  • fixing issue where hardbreak will crash android app. #56 Mient-jan Stelling 6/18/18, 16:30

v3.2.7

18 Jun 13:45

Choose a tag to compare

  • pass styles not style to View in AstRenderer Lauren Yeiser 6/4/18, 22:31

v3.2.6

04 Jun 13:59

Choose a tag to compare

  • v3.2.6 fixed issue where stringToTokens is not being exported correctly Mient-jan Stelling 6/4/18, 15:53
  • fixed issue where stringToTokens is not being exported correctly Mient-jan Stelling 6/4/18, 15:40
  • beta 3.2.5 removing of console.logs Mient-jan Stelling 6/4/18, 15:25
  • beta 3.2.4 fixed issue where images where only shown as copy. Mient-jan Stelling 6/4/18, 15:23
  • beta 3.2.4 fixed issue where images where only shown as copy. Mient-jan Stelling 6/4/18, 15:23
  • beta 3.2.3 Mient-jan Stelling 6/4/18, 15:11
  • cleaup of code, removing on used code #39 Mient-jan Stelling 6/4/18, 15:06
  • removing all unused functions. #39 Mient-jan Stelling 6/4/18, 14:56
  • fixed issue with images not linking. #39 Mient-jan Stelling 6/4/18, 14:53
  • adding styles to root style to markdown renderer #50 Mient-jan Stelling 6/4/18, 12:49
  • fixed issue Crash on hardbreak inside strong #51 Mient-jan Stelling 6/4/18, 12:36
  • fixed issue with bold copy #39 Mient-jan Stelling 6/4/18, 12:35
  • remove text and inline elements and rely on block property from token. #39 Mient-jan Stelling 6/4/18, 11:54
  • reformatting main class Mient-jan Stelling 6/4/18, 11:27

v3.2.2

04 Jun 09:17

Choose a tag to compare

  • fixing issue #52 fixed issue #46 Mient-jan Stelling 6/4/18, 11:15
  • fixing issue where softbreak is not seen as a inline element. #44 Mient-jan Stelling 5/22/18, 15:14
  • feature/export-applyStyle: Add to index.js and index.d.ts Aaron Houlihan 5/17/18, 18:30

v3.2.1

08 May 15:40

Choose a tag to compare

  • fixed issue where links where blocking rending of the rest of the markdown copy Mient-jan Stelling 5/8/18, 17:35

v3.2.0

08 May 12:58

Choose a tag to compare

  • adding info and meta as sourceInfo and sourceMeta #38 #27 Mient-jan Stelling 5/8/18, 14:45
  • adding meta to the new node from markdown-it meta #38 Mient-jan Stelling 5/8/18, 14:37
  • fixed issue #24 Mient-jan Stelling 5/3/18, 12:08
  • adding working example app Mient-jan Stelling 4/12/18, 20:13
  • #33 removing expo adding scratch example app Mient-jan Stelling 4/12/18, 19:29
  • fix issue where link url in openUrl function is not defined when clicking on that item will crash the app. Mient-jan Stelling 3/28/18, 19:37
  • fix PluginContainer.toArray doomsower 4/14/18, 20:34
  • Fix nodes and components types doomsower 4/14/18, 14:02
  • Fix typo doomsower 4/14/18, 13:51
  • Add typescript definitions doomsower 4/14/18, 13:49
  • Add styles property for easier overriding of styles doomsower 7/23/17, 15:42
  • Merge pull request #36 from Leeds-eBooks/patch-1 Mient-jan Stelling* 5/3/18, 12:12
  • Use bullet character for ul instead of middle-dot Ben Styles* 4/21/18, 18:45
  • adding prettierrc for prettier code formatting Mient-jan Stelling 3/28/18, 17:49
  • Merge pull request #30 from redbrick-health/additional-adds Mient-jan Stelling* 3/28/18, 17:40

v3.1.0

28 Mar 15:47
9b8f03d

Choose a tag to compare

  • bumped minor version Pete Carr 3/14/18, 15:31 #30
  • Adding hardbreak rule Pete Carr 3/14/18, 15:13 #30

v3.0.2

30 Jan 10:24

Choose a tag to compare

  • fixed issue where orderedLists and unorderedLists where cut off when having a long length. #21
  • fixed issue where orderedLists and unorderedLists where mis aligned. #22