Skip to content

Commit

Permalink
refactor: rename rule to indent-alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
onebytegone committed Jun 27, 2023
1 parent 453050d commit 8d5e79c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# markdownlint-rule-list-indentation
# markdownlint-rule-indent-alignment

<!-- markdownlint-disable line-length -->
[![NPM Version](https://img.shields.io/npm/v/@silvermine/markdownlint-rule-list-indentation.svg)](https://www.npmjs.com/package/@silvermine/markdownlint-rule-list-indentation)
[![License](https://img.shields.io/github/license/silvermine/markdownlint-rule-list-indentation.svg)](./LICENSE)
[![NPM Version](https://img.shields.io/npm/v/@silvermine/markdownlint-rule-indent-alignment.svg)](https://www.npmjs.com/package/@silvermine/markdownlint-rule-indent-alignment)
[![License](https://img.shields.io/github/license/silvermine/markdownlint-rule-indent-alignment.svg)](./LICENSE)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
<!-- markdownlint-enable line-length -->

Expand All @@ -26,14 +26,16 @@ the alignment of list items and blocks (e.g. code blocks). For example:
To use this custom markdownlint rule two things needed:

1. Update your [markdownlint config][markdownlint-config] to include
`"list-indention": true`
`"indent-alignment": true`
2. Add this rule to the list of [custom markdownlint rules][custom-rules-config].
If using [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli), this
would look something like:

<!-- markdownlint-disable line-length -->
```bash
markdownlint -r './node_modules/@silvermine/markdownlint-rule-list-indention/src/list-indention.js' -c .markdownlint.json README.md
markdownlint -r './node_modules/@silvermine/markdownlint-rule-indent-alignment/src/indent-alignment.js' -c .markdownlint.json README.md
```
<!-- markdownlint-enable line-length -->

## Rule configuration

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "@silvermine/markdownlint-rule-list-indentation",
"name": "@silvermine/markdownlint-rule-indent-alignment",
"version": "0.1.0",
"description": "A custom markdownlint rule for ordered and unordered list indentation",
"main": "src/list-indentation.js",
"description": "A custom markdownlint rule to ensure the proper alignment of indented content",
"main": "src/indent-alignment.js",
"scripts": {
"check-node-version": "check-node-version --npm 8.5.5",
"commitlint": "commitlint --from bb563e0fb7",
"eslint": "eslint '{,!(node_modules|dist)/**/}*.js'",
"markdownlint": "markdownlint -c .markdownlint.json -i CHANGELOG.md '{,!(node_modules)/**/}*.md'",
"standards": "npm run commitlint && npm run markdownlint && npm run eslint",
"test": "mocha --forbid-only ./tests/**/*.test.js",
"test": "mocha ./tests/**/*.test.js",
"release:preview": "node ./node_modules/@silvermine/standardization/scripts/release.js preview",
"release:prep-changelog": "node ./node_modules/@silvermine/standardization/scripts/release.js prep-changelog",
"release:finalize": "node ./node_modules/@silvermine/standardization/scripts/release.js finalize"
},
"repository": {
"type": "git",
"url": "git+https://github.com/silvermine/markdownlint-rule-list-indentation.git"
"url": "git+https://github.com/silvermine/markdownlint-rule-indent-alignment.git"
},
"keywords": [
"markdownlint",
Expand All @@ -25,9 +25,9 @@
"author": "Jeremy Thomerson",
"license": "MIT",
"bugs": {
"url": "https://github.com/silvermine/markdownlint-rule-list-indentation/issues"
"url": "https://github.com/silvermine/markdownlint-rule-indent-alignment/issues"
},
"homepage": "https://github.com/silvermine/markdownlint-rule-list-indentation#readme",
"homepage": "https://github.com/silvermine/markdownlint-rule-indent-alignment#readme",
"devDependencies": {
"@silvermine/chai-strictly-equal": "1.1.0",
"@silvermine/eslint-config": "3.1.0-beta.0",
Expand Down
8 changes: 4 additions & 4 deletions src/list-indentation.js → src/indent-alignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ function getReadableNameOfTokenForError(token) {

module.exports = {

names: [ 'list-indentation' ],
description: 'Ordered and unordered list indentation',
information: new URL('https://github.com/silvermine/markdownlint-rule-list-indentation'),
tags: [ 'bullet', 'ul', 'il', 'indentation' ],
names: [ 'indent-alignment' ],
description: 'Indent alignment of list items, wrapped lines, and blocks',
information: new URL('https://github.com/silvermine/markdownlint-rule-indent-alignment'),
tags: [ 'bullet', 'ul', 'il', 'indentation', 'paragraph' ],

'function': function listIndentation(params, onError) {
// Ensure top-level blocks and paragraphs are not indented
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
const { expect } = require('chai');

const { markdownlint } = require('markdownlint').promises,
listIndentation = require('../src/list-indentation');
indentAlignment = require('../src/indent-alignment');

describe('List Indentation', () => {
describe('Indent Alignment', () => {

async function runTest(lines, ruleConfig = true) {
const text = lines.join('\n') + '\n';

return markdownlint({
config: {
default: false,
'list-indentation': ruleConfig,
'indent-alignment': ruleConfig,
},
customRules: [ listIndentation ],
customRules: [ indentAlignment ],
strings: {
text,
},
Expand Down

0 comments on commit 8d5e79c

Please sign in to comment.