Skip to content

Commit

Permalink
Rewrite to ESM & cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
puzrin committed Dec 2, 2023
1 parent 558e9f3 commit 48a4061
Show file tree
Hide file tree
Showing 19 changed files with 228 additions and 275 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

117 changes: 0 additions & 117 deletions .eslintrc

This file was deleted.

22 changes: 22 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
extends: standard

overrides:
-
files: [ '*.mjs' ]
rules:
no-restricted-globals: [ 2, require, __dirname ]
-
files: [ 'test/**' ]
env: { mocha: true }
-
files: [ 'lib/**' ]
parserOptions: { ecmaVersion: 2015 }

ignorePatterns:
- demo/
- dist/
- benchmark/extra/

rules:
camelcase: 0
no-multi-spaces: 0
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily

- package-ecosystem: npm
directory: /
schedule:
interval: daily
allow:
- dependency-type: production
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
pull_request:
schedule:
- cron: '0 0 * * 3'

jobs:
test:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [ '18' ]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- run: npm install

- name: Test
run: npm test

- name: Upload coverage report to coveralls.io
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
coverage/
dist/
*.log
6 changes: 0 additions & 6 deletions .npmignore

This file was deleted.

4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

27 changes: 0 additions & 27 deletions bower.json

This file was deleted.

31 changes: 0 additions & 31 deletions dist/markdown-it-for-inline.js

This file was deleted.

2 changes: 0 additions & 2 deletions dist/markdown-it-for-inline.min.js

This file was deleted.

27 changes: 0 additions & 27 deletions index.js

This file was deleted.

17 changes: 17 additions & 0 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default function for_inline_plugin (md, ruleName, tokenType, iterator) {
function scan (state) {
for (let blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
if (state.tokens[blkIdx].type !== 'inline') continue

const inlineTokens = state.tokens[blkIdx].children

for (let i = inlineTokens.length - 1; i >= 0; i--) {
if (inlineTokens[i].type !== tokenType) continue

iterator(inlineTokens, i)
}
}
}

md.core.ruler.push(ruleName, scan)
}
48 changes: 27 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,36 @@
"markdown",
"iterator"
],
"homepage": "https://github.com/markdown-it/markdown-it-for-inline",
"repository": {
"type": "git",
"url": "git://github.com/markdown-it/markdown-it-for-inline.git"
},
"bugs": {
"url": "https://github.com/markdown-it/markdown-it-for-inline/issues"
},
"repository": "markdown-it/markdown-it-for-inline",
"license": "MIT",
"main": "index.js",
"main": "dist/index.cjs.js",
"module": "index.mjs",
"exports": {
".": {
"require": "./build/index.cjs.js",
"import": "./index.mjs"
},
"./*": {
"require": "./*",
"import": "./*"
}
},
"scripts": {
"test": "make test"
"lint": "eslint .",
"build": "rollup -c",
"test": "npm run lint && npm run build && c8 --exclude dist --exclude test -r text -r html -r lcov mocha",
"prepublishOnly": "npm run lint && npm run build"
},
"devDependencies": {
"browserify": "*",
"coveralls": "^2.11.2",
"eslint": "0.10.2",
"eslint-plugin-nodeca": "^1.0.0",
"istanbul": "*",
"lodash": "*",
"markdown-it": "^4.0.0",
"markdown-it-testgen": "~0.1.0",
"mocha": "*",
"request": "*",
"uglify-js": "*"
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"c8": "^8.0.1",
"eslint": "^8.55.0",
"eslint-config-standard": "^17.1.0",
"markdown-it": "^13.0.2",
"markdown-it-testgen": "^0.1.6",
"mocha": "^10.2.0",
"rollup": "^4.6.1"
}
}
Loading

0 comments on commit 48a4061

Please sign in to comment.