New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@anzeblabla/react-native-markdown-editor

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anzeblabla/react-native-markdown-editor

This is a rewrite of [react-native-markdown-editor](https://www.npmjs.com/package/react-native-markdown-editor), a library for rendering a markdown editor for the markdown with helper buttons to easily write markdown. It uses [react-native-markdown-view]

latest
npmnpm
Version
2.1.1
Version published
Maintainers
0
Created
Source

react-native-markdown-editor

This is a rewrite of react-native-markdown-editor, a library for rendering a markdown editor for the markdown with helper buttons to easily write markdown. It uses react-native-markdown-view to preview the markdown.

Index

Getting Started

Install the node module:

yarn add react-native-markdown-editor

or with npm:

npm install --save react-native-markdown-editor

Then see Usage for futher details

Features

  • Multiline textinput for writing markdown
  • Live preview of the markdown written (can be hidden)
  • Helper buttons to write the syntax for the markdown
Markdown where editor helps (in order for the default format)

Bold Text

Italic Text

Underline text

Strikethrough

Inline code

  • Item 1
  • Item 2

Url Links:

GitHub

function codeExample(arg) {
}

This is an < h1 > tag

Usage

Import the editor through

import { MarkdownEditor } from 'react-native-markdown-editor';

And use like this this in the jsx

<MarkdownEditor />

And pass a function onMarkdownChange which will be callback when markdown is changed

 <MarkdownEditor onMarkdownChange={this.onTextChange} />

It can be used with a toolbar and have a submit menu option there!

Customizing

Your own custom formats

You can give a custom list of buttons you want to give the default is Formats by speicifying

   <MarkdownEditor Formats={YOUR_CUSTOM_Formats} />

Customize the helper button

You can customize the helper button using the markdownButton prop. The buttons are rendered using a FlatList and the data passed is the Formats

markdownButton can be method like

const defaultMarkdownButton = ({ item, getState, setState }) =>
  <Button
    title={item.key}
    onPress={() => item.onPress({ getState, setState, item })}
    color={FOREGROUND_COLOR}
    style={inlinePadding}
  />

Where item is an each object in the Formats list

You can also import the methods used in Formats by using

import { applyWrapFormatNewLines, applyWrapFormat, applyWebLinkFormat, applyListFormat } from 'react-native-markdown-editor';

Customize the renderButton styles

You can add a style key in the Formats.js and this will be used while rendering the button

{ key: 'B', wrapper: '**', onPress: applyWrapFormat, style: { fontWeight: 'bold' } },

Props

NameTypeDefaultDescription
FormatsArrayFormatsElements for the markdown buttons
markdownButtonfunctiondefaultMarkdownButtonA custom function to render the markdown buttons
onMarkdownChangefunctionCallback function, calls when markdown is typed
showPreviewbooleanfalseTo show the markdown preview by Default

Contributing

PR's/Issues/Bugs or suggestions are welcomed.

License

The MIT License.

See LICENSE

FAQs

Package last updated on 23 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts