Skip to content

Commit

Permalink
chore: merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-r committed Aug 23, 2024
2 parents 29025fa + eb28316 commit 88b9944
Show file tree
Hide file tree
Showing 6 changed files with 1,981 additions and 1,613 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-batcher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Dependabot Batcher
uses: Legal-and-General/[email protected].3
uses: Legal-and-General/[email protected].4
with:
token: ${{ secrets.GITHUB_TOKEN }}
baseBranchName: 'beta' #optional
Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "languagetool-cli",
"version": "1.0.3",
"version": "1.0.11",
"description": "Command line tool to check for spelling errors in documents",
"main": "dist/language-tool.js",
"bin": {
Expand All @@ -26,43 +26,43 @@
"@commitlint/cli": "18.6.0",
"@commitlint/config-conventional": "18.5.0",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/commit-analyzer": "11.1.0",
"@semantic-release/commit-analyzer": "13.0.0",
"@semantic-release/git": "10.0.1",
"@semantic-release/npm": "11.0.2",
"@semantic-release/release-notes-generator": "12.1.0",
"@types/node": "20.11.16",
"@semantic-release/npm": "12.0.1",
"@semantic-release/release-notes-generator": "14.0.1",
"@types/node": "20.11.2",
"@types/node-fetch": "2.6.11",
"@types/qs": "6.9.11",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"@typescript-eslint/eslint-plugin": "8.2.0",
"@typescript-eslint/parser": "8.2.0",
"commitizen": "4.3.0",
"cz-conventional-changelog": "3.3.0",
"eslint": "8.56.0",
"husky": "9.0.10",
"husky": "9.1.5",
"is-ci": "3.0.1",
"prettier": "3.2.4",
"semantic-release": "23.0.0",
"semantic-release": "24.1.0",
"ts-node": "10.9.2",
"vite": "5.0.12",
"vitest": "1.2.0"
"vite": "5.1.7",
"vitest": "2.0.5"
},
"dependencies": {
"annotatedtext": "1.2.0",
"axios": "1.6.7",
"commander": "11.1.0",
"annotatedtext": "1.2.1",
"axios": "1.7.4",
"commander": "12.1.0",
"concurrent-queue": "7.0.2",
"find-up": "6.3.0",
"mdast-util-directive": "3.0.0",
"micromark-extension-directive": "3.0.0",
"micromark-extension-directive": "3.0.1",
"qs": "6.11.2",
"remark-directive": "3.0.0",
"remark-frontmatter": "5.0.0",
"remark-gfm": "4.0.0",
"remark-parse": "11.0.0",
"typescript": "5.3.3",
"vfile": "6.0.1",
"vfile-location": "5.0.2",
"vfile-reporter": "8.1.0",
"vfile": "6.0.2",
"vfile-location": "5.0.3",
"vfile-reporter": "8.1.1",
"winston": "3.11.0"
},
"commitlint": {
Expand Down
6 changes: 6 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
}
49 changes: 47 additions & 2 deletions src/language-tool.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,57 @@
import { applyEnableDisable, customMarkdownInterpreter } from './language-tool';

import { describe, expect, test } from 'vitest'
import { describe, expect, test } from 'vitest';

describe('custom markup', async () => {
test('Test empty string', async () => {
expect(customMarkdownInterpreter('')).toBe('');
});
});

test('newlines', async() => {
expect(customMarkdownInterpreter('\n\nTest\n\n')).toBe('\n\n\n\n');
});

// enumerations
test('numbers 1', async() => {
expect(customMarkdownInterpreter('Some Text\n1. ')).toBe('\n** ');
});

test('numbers 2', async() => {
expect(customMarkdownInterpreter('Some Text\n2. ')).toBe('\n** ');
});

test('numbers 10', async() => {
expect(customMarkdownInterpreter('Some Text\n10. ')).toBe('\n** ');
});

test('numbers 2000', async() => {
expect(customMarkdownInterpreter('2000. ')).toBe('** ');
});

test('numbers 10000', async() => {
expect(customMarkdownInterpreter('Some Text\n10000. ')).toBe('\n');
});

// block comments
test('blockcomment simple', async() => {
expect(customMarkdownInterpreter(':: Test ::')).toBe('# ');
});

test('blockcomment simple2', async() => {
expect(customMarkdownInterpreter(':::::: Test ::::')).toBe('# ');
});

test('regexopt 1', async() => {
const s = '::: ' + 'A'.repeat(999) + ':::'
expect(customMarkdownInterpreter(s)).toBe('# ');
});

test('regexopt 2', async() => {
const s = '::: ' + 'A'.repeat(1000) + ":::"
expect(customMarkdownInterpreter(s)).toBe('');
});

});

describe("comment parsing", async () => {
test('applyEnableDisable - keep empty', async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/language-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function customMarkdownInterpreter(text: string): string {
if (text.match(/^(?!\s*`{3})\s*`{1,2}/)) {
// Treat inline code as redacted text
interpretation = "`" + "#".repeat(text.length - 2) + "`";
} else if (text.match(/::+[^:]+::+/)) {
} else if (text.match(/::+([^:]{1,1000}::+)/)) {
// block comments
interpretation += "# ";
} else if (text.match(/#\s+$/)) {
Expand All @@ -147,7 +147,7 @@ export function customMarkdownInterpreter(text: string): string {
} else if (text.match(/\*\s+$/)) {
// Preserve bullets without leading spaces
interpretation += "* ";
} else if (text.match(/\d+\.\s+$/)) {
} else if (text.match(/([^\d]|^)\d{1,4}\.\s+$/)) {
// Treat as bullets without leading spaces
interpretation += "** ";
}
Expand Down
Loading

0 comments on commit 88b9944

Please sign in to comment.