@haxcms/migrate-markdown

0.0.13 • Public • Published

@haxcms/migrate-regex

Install

$ npm install -g @haxcms/migrate-markdown
$ migrate-markdown COMMAND
running command...
$ migrate-markdown (-v|--version|version)
@haxcms/migrate-markdown/0.0.13 darwin-x64 node-v12.13.0
$ migrate-markdown --help [COMMAND]
USAGE
  $ migrate-markdown COMMAND
...
$ npm install -g @haxcms/migrate-regex
$ migrate-regex COMMAND
running command...
$ migrate-regex (-v|--version|version)
@haxcms/migrate-regex/0.0.0 darwin-x64 node-v10.12.0
$ migrate-regex --help [COMMAND]
USAGE
  $ migrate-regex COMMAND
...

Usage

Define patterns and replacements

In your HAXcms site, create a file called migrate.json. By default migrate-regex will assume this file is a sibling of site.json.

Define your patterns in the regex property. Example:

{
  "regex": [
    {
      "pattern": "<",
      "replacement": "<"
    },
    {
      "pattern": "&gt;",
      "replacement": ">"
    },
    {
      "pattern": "&quot;",
      "replacement": "\""
    },
    {
      "pattern": "(\\$\\$(?:(?!\\$\\$)[\\s\\S])*?)(<\/?em>)([\\s\\S]*?\\$\\$)",
      "replacement": "$1_$3"
    },
    {
      "pattern": "(\\$\\$)([^\\$\\$]*)(\\$\\$)",
      "replacement": "<lrn-math>$2</lrn-math>"
    }
  ]
}

Run regex migration

$ migrate-regex run -j site.json

Readme

Keywords

Package Sidebar

Install

npm i @haxcms/migrate-markdown

Weekly Downloads

1

Version

0.0.13

License

Apache 2.0

Unpacked Size

6.49 kB

Total Files

7

Last publish

Collaborators

  • btopro
  • heymp