2.1.38 • Published 8 months ago

@slimr/markdown v2.1.38

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

🪶 @slimr/markdown npm package

A tiny markdown parser and react component

Context

@slimr is a set of slim React (hence '@slimr') libs. Check them all out on github!

API

parse

Converts a limited markdown subset to HTML

  • 2Kb zipped, 1kb when bundled with other code
  • ...is very small relatively speaking
  • Keeps bundle small by clever coding and not supporting every markdown feature

Supported Syntax

  • headings, i.e. # H1, ## H2, ### H3, #### H4, ##### H5, ###### H6
  • alt H1 heading, i.e. H1\n===
  • alt H2 heading, i.e. H1\n---
  • Horizontal rule/lines, i.e. *** --- ___
  • bold
  • italic
  • strikethrough
  • links, i.e. Link Link with title
  • reference links, i.e. link1-text
  • images, i.e. Image Image with title
  • ordered and unordered lists up to one level. nesting not supported.
  • code blocks
  • Most HTML is passed through without modification, except scripts/style which will be HTML encoded
import {parse} from '@slimr/markdown'

const html = parse(`
  # ~~The Jungle~~Heaven

  Welcome to ~~the jungle~~heaven, baby.
`)

Markdown

A component that displays markdown as html, using src/parse for conversion

Paremeters:

  • applyCodeSyntaxHighlights: Whether to apply syntax highlighting to code blocks. Uses highlight.js which is lazy loaded but HUGE (~20kb). So, if you don't need it, don't use it.
  • src: A string containing markdown to be displayed
import {Markdown} from '@slimr/markdown'

function MyComponent() {
  return (
    <Markdown
      src={`
    # ~~The Jungle~~Heaven

    Welcome to ~~the jungle~~heaven, baby.
  `}
    />
  )
}
2.1.27

9 months ago

2.1.28

9 months ago

2.1.25

9 months ago

2.1.26

9 months ago

2.1.24

9 months ago

2.1.29

9 months ago

2.1.38

8 months ago

2.1.36

8 months ago

2.1.37

8 months ago

2.1.34

9 months ago

2.1.35

8 months ago

2.1.30

9 months ago

2.1.31

9 months ago

2.1.23

1 year ago

2.1.22

1 year ago

2.1.21

1 year ago

2.1.20

1 year ago

2.1.19

1 year ago

2.1.18

1 year ago

2.1.17

1 year ago

2.1.16

1 year ago

2.1.14

1 year ago

2.1.13

1 year ago

2.1.12

1 year ago

2.1.11

1 year ago

2.1.10

1 year ago

2.1.7

1 year ago

2.1.6

1 year ago

2.1.5

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago