0.1.1 • Published 5 years ago

indented-filter v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

indented-filter

Indented filter maker for Showdown extension / Hyperpug

Installation

npm i indented-filter

Usage

import { createIndentedFilter } from "indented-filter";
const filterFn = createIndentedFilter("^^x1", (coveredText, attrs) => {
  return customFn(coveredText, attrs)
});
const showdownX1Extension = {
  type: "lang",
  filter: filterFn
};

Example matched cases,

^^x1 hello
^^x1(source="github") hello
![](^^x1(source="github") hello^^)
^^x1(source="github").
  thank you
    very

  much

For more test cases, see /tests/index.spec.ts

For my use case, see, https://github.com/patarapolw/zhdiary/blob/master/src/plugins/showdown-ext.js#L23

For more information about custom Showdown extensions, see https://github.com/showdownjs/showdown/wiki/Extensions.