Skip to content

Releases: iamacup/react-native-markdown-display

6.1.1

25 May 08:08
e41a9f2
Compare
Choose a tag to compare

Fixes up the typescript defs here #68 - many thanks to @lukeramsden

6.1.0

12 May 21:07
Compare
Choose a tag to compare
  • A non existent rule will now no longer fatally error out if found, instead the unknown rule will be rendered (which, by default, renders null (nothing)) and instead a console.warn is shown.

  • Changed import location of MarkdownIt - if you were using a custom markdown-it instance and importing it from this library - just change this import MarkdownIt from 'react-native-markdown-display/src/MarkdownIt'; to import Markdown, { MarkdownIt} from 'react-native-markdown-display';

  • The plugins property is completely removed, if you used it previously, you need to use a custom MarkdownIt instance instead and apply the plugins directly, see the updated readme file for plugin example. This was removed because it was a custom component that wrapped markdown-it plugins, but we already expose the markdown-it instance and allow for changes to it - hangover from react-native-markdown-display

  • Removed the PluginContainer export (this was used with the plugins property)

  • Updated the readme with a full plugin example

  • Removed the export of BlockPlugin - hangover from react-native-markdown-display

  • Fixed an error when specifying a non default style with mergeStyles={true} - the non default style is not added

  • thanks to @rajivshah3 for fixing the gitignore here: #64

  • Updated dependencies

6.0.1

24 Feb 21:29
Compare
Choose a tag to compare

Fixed #53: Thanks to @realToadtoad

6.0.0

24 Feb 20:00
755c17b
Compare
Choose a tag to compare

WARNING POTENTIALLY BREAKING: NAME CHANGES FOR STYLES AND RENDER RULES

This release fixes up the naming convention for styles and rules so that, on the whole they match and are easier to use and understand. It also improves how the rules and styles are applied making styling even more flexible and accurate

POTENTIALLY BREAKING STUFF

  • Some render rules has been renamed
  • Some styles have been renamed
  • The default value of the mergeStyle prop is now true, meaning that all styles are merged not overwritten by default, if you relied on this behaviour, just set mergeStyle to false
  • The code_block (previously codeBlock) style does not apply to fence anymore, this is a separate style and render rule, if you want to change all code blocks make sure to modify either a parent style (body, for example) or both fence and code_block styles / render rules
  • lists have had their render hierarchy changed - important to know if you have overwritten styles further up / down the tree as they may be in different positions now

Render Rule Changes

From To
root body

Style Changes - General

From To
root body
codeBlock code_block
codeInline code_inline
headingContainer DELETED - use heading1...heading6
heading DELETED - use heading1...heading6
tableHeader thead
tableHeaderCell th
tableRow tr
tableRowCell td
textGroup textgroup
strikethrough s

Style Changes - Lists

While some of these things have been 'renamed' they have also been moved around in the hierarchy to make more sense - here is the current render setup:

-ordered_list
--list_item (which contains ordered_list_icon and ordered_list_content as styles without render rules)
---paragraph
----textgroup
-----text

-bullet_list
--list_item (which contains bullet_list_icon and bullet_list_content as styles without render rules)
---paragraph
----textgroup
-----text
From To
list DELETED - use list_item or bullet_list / ordered_list
listItem list_item
listUnordered bullet_list
listUnorderedItemIcon bullet_list_icon
listUnorderedItem bullet_list_content
listOrdered ordered_list
listOrderedItemIcon ordered_list_icon
listOrderedItem ordered_list_content

Other minor things

  • Removal of the examples directory, the readme has been significantly updated so maintaining a separate examples set does not seem needed

  • Updated the numbers documentation, the implementation behaves per markdown-it (commonmark) spec, but the documentation did not match that spec

The complete list of render rules and styles (also available in the readme) after the changes in this version

Render Rule Style(s)
body body
heading1 heading1
heading2 heading2
heading3 heading3
heading4 heading4
heading5 heading5
heading6 heading6
hr hr
strong strong
em em
s s
blockquote blockquote
bullet_list bullet_list
ordered_list ordered_list
list_item list_item - This is a special case that contains a set of pseudo classes that don't align to the render rule: ordered_list_icon, ordered_list_content, bullet_list_icon, bullet_list_content
code_inline code_inline
code_block code_block
fence fence
table table
thead thead
tbody tbody
th th
tr tr
td td
link link
blocklink blocklink
image image
text text
textgroup textgroup
paragraph paragraph
hardbreak hardbreak
softbreak softbreak
pre pre
inline inline
span span

5.1.1

24 Feb 15:02
Compare
Choose a tag to compare

5.1.0

13 Dec 15:26
df5d90f
Compare
Choose a tag to compare

react-native-web support:

  • removed the stylesheet from styles.js - now we just export an object
  • we now apply a default for all platform.selects
  • flatten styles for custom display styles on text display items

optimisations (+react-native-web things):

  • removed repeated calls to removeTextStyleProps in render rules
  • created a stylesheet after merging of style prop for views only

Other

  • fixed bug where passing mergeStyle with no style prop crashed out

5.1.0-rc1

12 Dec 20:26
Compare
Choose a tag to compare
5.1.0-rc1 Pre-release
Pre-release

react-native-web support:

  • removed the stylesheet from styles.js - now we just export an object
  • we now apply a default for all platform.selects
  • flatten styles for custom display styles on text display items

optimisations (+react-native-web things):

  • removed repeated calls to removeTextStyleProps in render rules
  • created a stylesheet after merging of style prop for views only

Other

  • fixed bug where passing mergeStyle with no style prop crashed out

5.0.0

06 Dec 17:49
a8bf455
Compare
Choose a tag to compare

This release may cause style issues

While this release shouldn’t outright break compatibility with react-native-markdown-renderer, or people who are using react-native-markdown-display it may cause some style issues. check out the example at the end of these notes.

  • Added mergeStyle prop - by default this is false for backwards compatibility but if true, the style prop will merge with pre-defined styles instead of overwriting them
  • Stopped applying text styles to Views (#44)
  • Changed the unknown element to render nothing instead of some strange error component by default - can still be changed through render rules
  • Remove platform enum to make it easier to override styles and render rules
  • Remove some unused style definitions
  • Added a key to the default topLevelMaxExceededItem value
  • Reworked how the root element is rendered so it can be used to apply global styles to text etc.
  • Removed some use of styles.text so that styles.text is only used on the text render rule, not elsewhere as some kind of weird text styling thing
  • Swap priority of styles when rendering - applies them in order of priority parent (least) to child (most)
  • Updated how text styles are applied (and updated the readme) to apply them to non-traditional text style items - see below

Text styles are now applied in a way that makes it much more convenient to manage changes to global styles while also allowing fine tuning of individual elements.

Think of the new implementation like applying styles in CSS. changes to the body effect everything, but can be overwritten further down the style / component tree

The gotcha is if you try to use the text style override to change all text styles, this only changes things that are rendered using the ‘text’ rule. Instead you should change root, and then modify other styles (like code blocks and quotes etc) as needed.

an example:

    const copy = `
    This is some text which is red because of the root style, which is also really small!

    ```
    //This is a code block woooo

    const cool = () => {
      console.log('????');
    };
    ```

    and some more small text

    # This is a h1
    ## this is a h2
    ### this is a h3
    `;

    const App: () => React$Node = () => {
      return (
        <>
          <SafeAreaView>
            <View style={{marginHorizontal: 20}}>
              <Markdown
                mergeStyle={true} 
                style={{
                  root: {color: 'red', fontSize: 10},
                  heading1: {color: 'purple'},
                  codeBlock: {color: 'black', fontSize: 14}
                }}
              >
                {copy}
              </Markdown>
            </View>
          </SafeAreaView>
        </>
      );
    };

4.1.0

05 Dec 16:24
d2d484c
Compare
Choose a tag to compare

This is the first 'big' release of this library that fixed up all of the outstanding hang-over formatting errors from react-native-markdown-renderer while also adding a bunch more features from a variety of contributors!

thanks to all the contributors!

4.0.13

05 Dec 14:17
Compare
Choose a tag to compare
4.0.13 Pre-release
Pre-release