All Projects → CharlesMangwa → React Native Simple Markdown

CharlesMangwa / React Native Simple Markdown

Licence: mit
📜 React Native Markdown component (iOS & Android).

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Simple Markdown

Imgui markdown
Markdown for Dear ImGui
Stars: ✭ 594 (+52.7%)
Mutual labels:  markdown, library
React Markdown
Markdown editor (input) based on React
Stars: ✭ 98 (-74.81%)
Mutual labels:  markdown, library
Blink Mind React
A mind map library for react that based on immutable.js.
Stars: ✭ 38 (-90.23%)
Mutual labels:  markdown, library
Commonmark Java
Java library for parsing and rendering CommonMark (Markdown)
Stars: ✭ 1,675 (+330.59%)
Mutual labels:  markdown, library
Markdown Builder
1kb Markdown builder for Node.js
Stars: ✭ 67 (-82.78%)
Mutual labels:  markdown, library
Java Markdown Generator
Java library to generate markdown
Stars: ✭ 159 (-59.13%)
Mutual labels:  markdown, library
Android Customtabs
Chrome CustomTabs for Android demystified. Simplifies development and provides higher level classes including fallback in case Chrome isn't available on device.
Stars: ✭ 378 (-2.83%)
Mutual labels:  library
Forum Java
一款用 Java(spring boot) 实现的现代化社区(论坛/问答/BBS/社交网络/博客)系统平台。A modern community (forum/Q&A/BBS/SNS/blog) system platform implemented in Java(spring boot).
Stars: ✭ 380 (-2.31%)
Mutual labels:  markdown
Theglowingloader
TheGlowingLoader is the highly configurable library to indicate progress and is natively created for Android Platform. It is an implementation of a design composed by Shashank Sahay.
Stars: ✭ 379 (-2.57%)
Mutual labels:  library
Md To Pdf
Hackable CLI tool for converting Markdown files to PDF using Node.js and headless Chrome.
Stars: ✭ 374 (-3.86%)
Mutual labels:  markdown
Kooper
Kooper is a simple Go library to create Kubernetes operators and controllers.
Stars: ✭ 388 (-0.26%)
Mutual labels:  library
Linux Steam Integration
Helper for enabling better Steam integration on Linux
Stars: ✭ 386 (-0.77%)
Mutual labels:  library
Commonmarkattributedstring
Create NSAttributedStrings from Markdown Text
Stars: ✭ 382 (-1.8%)
Mutual labels:  markdown
Marktext
📝A simple and elegant markdown editor, available for Linux, macOS and Windows.
Stars: ✭ 22,894 (+5785.35%)
Mutual labels:  markdown
Beam
✨ Expressive WebGL
Stars: ✭ 383 (-1.54%)
Mutual labels:  library
Lager
C++ library for value-oriented design using the unidirectional data-flow architecture — Redux for C++
Stars: ✭ 379 (-2.57%)
Mutual labels:  library
Github Markdown Toc.go
Easy TOC creation for GitHub README.md (in go)
Stars: ✭ 387 (-0.51%)
Mutual labels:  markdown
Whu Library Seat Mobile
武汉大学图书馆助手 - 移动端
Stars: ✭ 374 (-3.86%)
Mutual labels:  library
Androidplot
Charts and plots for Android
Stars: ✭ 381 (-2.06%)
Mutual labels:  library
Swaggen
OpenAPI/Swagger 3.0 Parser and Swift code generator
Stars: ✭ 385 (-1.03%)
Mutual labels:  library

react-native-simple-markdown

CircleCI npm downloads Commitizen friendly npm version

A component for rendering Markdown in React Native with native components, working with both iOS & Android. Pull requests are welcome! 😃 🎉

Getting started

yarn add react-native-simple-markdown

Future

This library is currently being (kinda) completely rewritten. If you've been using this lib for a short/long time or are interesting in shaping it for the future: just chime in and share your thoughts with us; or give a look at the styles section, some help is also need there!

Usage

All you need to do is import the react-native-simple-markdown and then use the <Markdown /> component.

import React from 'react'
import Markdown from 'react-native-simple-markdown'

const MyAwesomeApp = () => {
  return (
    <Markdown styles={markdownStyles}>
      #Markdown in react-native is so cool! {'\n\n'}

      You can **emphasize** what you want, or just _suggest it_ 😏…{'\n'}

      You can even [**link your website**](https://twitter.com/Charles_Mangwa) or if you prefer: [email somebody](mailto:[email protected]){'\n'}

      Spice it up with some GIFs 💃:

      ![Some GIF](https://media.giphy.com/media/dkGhBWE3SyzXW/giphy.gif){'\n'}

      And even add a cool video 😎!{'\n'}

      [![A cool video from YT](https://img.youtube.com/vi/dQw4w9WgXcQ/0.jpg)](http://www.youtube.com/watch?v=dQw4w9WgXcQ)

      [![Another one from Vimeo](https://i.vimeocdn.com/video/399486266_640.jpg)](https://vimeo.com/57580368)
    </Markdown>   
  )
}

const markdownStyles = {
  heading1: {
    fontSize: 24,
    color: 'purple',
  },
  link: {
    color: 'pink',
  },
  mailTo: {
    color: 'orange',
  },
  text: {
    color: '#555555',
  },
}

Properties

styles

<Markdown /> will apply its style by default. However you can pass a styles prop to customize it has you wish.

Example:

<Markdown
  styles={{
    heading1: {
      fontSize: 20,
    },
    strong: {
      fontWeight: 'bold',
    }
  }}
>
  #Hello 👋
</Markdown>

rules

Here again, <Markdown /> will apply its rules by default. However you can pass a rules prop to add your own and then customize how the Markdown elements will be displayed!

Example:

<Markdown
  rules={{
    image: {
      react: (node, output, state) => (
        <CustomImageComponent
          key={state.key}
          source={{ uri: node.target }}
        />
      ),
    },
  }}
>
  ![Alt text](/path/to/img.jpg)
</Markdown>

RNSM also allows you to remove easily unwanted styling options without having to pass in rule objects that have their react key implemented/dummied to ignore those styling options.

Example:

<Markdown
  styles={ markdownStyles }
  whitelist={['link', 'url']}
>
  { description }
</Markdown>

whitelist will only apply link and url default styles, while blacklist will do the opposite. You don't need to pass in a rules prop that contained a key for all the styles you don't want and reimplement their styling output anymore.

errorHandler

If you happened to have an error with your Markdown during the rendering, you can pass a errorHandler with a function that will let you see what's going on:

<Markdown
  errorHandler={(errors, children) => console.log(errors, children)}
>
...
</Markdown>

Styles

Given that the way React Native renders element has evolved in the latest versions (0.48+), we'll have to check manually that every single rule works as expected by:

  • rendering properly on both iOS & Android
  • being able to be styled on both platforms
  • not breaking/overriding others rules when its own is applied

When those 3 criteria are fulfilled, we can validate the Rendering column. Feel free to check any of these and send a PR to validate it on Snack!

Property Type Rendering  Features
blockQuote <View> Also blockQuoteBar (<View>) and blockQuoteText (<Text>)
br <Text> -
del <Text> -
em <Text> -
hr <View> -
heading <Text>  Also heading1 through heading6
image <Image>  ou can use resizeMode in <Markdown /> styles prop to set a resizeMode
inlineCode <Text>  -
link <Text>  -
list <View>  Also listItem (<View>), listItemBullet (<Text>), listItemBulletType (Unicode character), listItemNumber (<Text>) and listItemText (<Text>)
mailTo <Text>  -
paragraph <View>  -
plainText <Text> Used for styling text without any associated styles
strong <Text>  -
table <View>  -
tableHeader <View>  -
tableHeaderCell <View>  -
tableRow <View>  -
tableRowCell <View>  -
tableRowLast <View>  Inherits from tableRow
text <Text>  -
u <Text>  -
url <Text>  -
video <Image>  Supports YouTube & Vimeo
view <View>  This is the View container where the Markdown is rendered

Credits

This project was forked from react-native-markdown by @lwansbrough 👍

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].