https://github.com/akinoccc/markdown-matcher
the matcher which has reg expression and some methods about markdown.
https://github.com/akinoccc/markdown-matcher
markdown regexp regexp-match
Last synced: 3 months ago
JSON representation
the matcher which has reg expression and some methods about markdown.
- Host: GitHub
- URL: https://github.com/akinoccc/markdown-matcher
- Owner: akinoccc
- Created: 2022-06-03T17:06:03.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-07-18T17:03:38.000Z (almost 3 years ago)
- Last Synced: 2025-02-13T13:43:15.230Z (3 months ago)
- Topics: markdown, regexp, regexp-match
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Markdown-Matcher
![]()
![]()
![]()
![]()
## Install```shell
npm i markdown-matcher --save
```## Usage
### regexp constant
you can import the regular expression from `markdown-matcher` for other purposes.
```js
import { HEADER, H1, H2, LINK } from 'markdown-matcher';
```### match
```js
import { H1, match } from 'markdown-matcher';
const str = '# header1 \n 1234';
match(str, 'h1'); // => # header1
```### hasHeader
Determine if header exists.
```js
import { hasHeader } from 'markdown-matcher';
const str = '# header1 \n 1234';
hasHeader(str, 'header'); // => true
hasHeader(str, 'h1'); // => true
hasHeader(str, 'h2'); // => false
```### hasLink
Determine if link exists.
```js
import { hasLink } from 'markdown-matcher';
const str = '[](http://abc.com) \n 1234';
hasLink(str); // => true
```### hasCodeBlock
Determine if code block exists.
````js
import { hasCodeBlock } from 'markdown-matcher';
const str = '```js var a = 1``` \n 1234';
hasCodeBlock(str); // => true
````### more
`hasImage`, `hasItalic`, `hasBold`, `hasHeightLight`