Skip to content

Commit

Permalink
fix: Update Markdown dictionary (#3713)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S authored Oct 22, 2024
1 parent 9714d0b commit 1394c0b
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 59 deletions.
55 changes: 55 additions & 0 deletions dictionaries/cspell/cspell-ext.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@cspell/dict-lorem-ipsum/cspell-ext.json",
"@cspell/dict-lua/cspell-ext.json",
"@cspell/dict-makefile/cspell-ext.json",
"@cspell/dict-markdown/cspell-ext.json",
"@cspell/dict-monkeyc/cspell-ext.json",
"@cspell/dict-node/cspell-ext.json",
"@cspell/dict-npm/cspell-ext.json",
Expand All @@ -57,5 +58,59 @@
"@cspell/dict-terraform/cspell-ext.json",
"@cspell/dict-typescript/cspell-ext.json",
"@cspell/dict-vue/cspell-ext.json"
],
"languageSettings": [
{
"languageId": "javascript,javascriptreact",
"dictionaries": ["typescript", "node", "npm"]
},
{
"languageId": "typescript,typescriptreact,mdx",
"dictionaries": ["typescript", "node", "npm"]
},
{
"languageId": "javascriptreact,typescriptreact,mdx",
"dictionaries": ["html", "html-symbol-entities", "css", "fonts"]
},
{
"languageId": "markdown,asciidoc",
"dictionaries": ["npm", "html", "html-symbol-entities"]
},
{
"languageId": "html,pug,jade,php,handlebars",
"dictionaries": ["html", "fonts", "typescript", "css", "npm", "html-symbol-entities"]
},
{
"languageId": "json,jsonc",
"dictionaries": ["node", "npm"]
},
{
"languageId": "php",
"dictionaries": ["php"]
},
{
"languageId": "css,less,scss",
"dictionaries": ["fonts", "css"]
},
{
"languageId": "map",
"enabled": false
},
{
"languageId": "image",
"enabled": false
},
{
"languageId": "binary",
"enabled": false
},
{
"languageId": "markdown,html,mdx",
"ignoreRegExpList": ["HTML-symbol-entity"]
},
{
"languageId": "html",
"ignoreRegExpList": ["href"]
}
]
}
3 changes: 2 additions & 1 deletion dictionaries/cspell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"./cspell-ext.json": "./cspell-ext.json"
},
"scripts": {
"build": "node ./scripts/build.mjs",
"build": "node ./scripts/build.mjs && prettier cspell-ext.json --write ",
"test": "cspell --no-default-configuration .",
"prepublishOnly": "echo OK",
"prepare:dictionary": "pnpm run build"
Expand Down Expand Up @@ -72,6 +72,7 @@
"@cspell/dict-lorem-ipsum": "workspace:*",
"@cspell/dict-lua": "workspace:*",
"@cspell/dict-makefile": "workspace:*",
"@cspell/dict-markdown": "workspace:*",
"@cspell/dict-monkeyc": "workspace:*",
"@cspell/dict-node": "workspace:*",
"@cspell/dict-npm": "workspace:*",
Expand Down
5 changes: 5 additions & 0 deletions dictionaries/html/cspell-ext.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
{
"name": "HTML-IDREF-for",
"pattern": "/\\bfor=\"[^\"]*\"/gi"
},
{
"name": "HTML-symbol-entity",
"description": "Matches on HTML symbols like `♣`",
"pattern": "/&[a-z]+;/gi"
}
],
// Language Rules to apply to matching files.
Expand Down
45 changes: 1 addition & 44 deletions dictionaries/markdown/cspell-ext.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,3 @@
{
"id": "markdown",
"version": "0.2",
"name": "Markdown",
"description": "Markdown dictionary for cspell.",
"readonly": true,
"dictionaryDefinitions": [
{
"name": "markdown",
"path": "./markdown.txt.gz",
"description": "Markdown dictionary for cspell."
}
],
"patterns": [
{
"name": "MARKDOWN-link-reference",
"description": "Markdown reference link: `[This is a link][reference]`",
"pattern": "/(?<=\\])\\[[-\\w.`'\"*&;#@ ]+\\]/g"
},
{
"name": "MARKDOWN-link-footer",
"description": "Markdown referenced link: `[reference]: https://www.google.com`",
"pattern": "/\\[[-\\w.`'\"*&;#@ ]+\\]:( [^\\s]*)?/g"
},
{
"name": "MARKDOWN-link",
"description": "Markdown link: `[link text](link)`, matches `link`",
"pattern": "/(?<=\\]\\()[^)\\s]+/g"
},
{
"name": "MARKDOWN-anchor",
"description": "Markdown Anchors: `<a id=\"my_link\"></a>`, matches `my_link`",
"pattern": "/(?<=<a\\s+id=\")[^\"\\s]+/g"
}
],
"languageSettings": [
{
"languageId": "markdown,mdx",
"locale": "*",
"ignoreRegExpList": ["MARKDOWN-link-reference", "MARKDOWN-link-footer", "MARKDOWN-link", "MARKDOWN-anchor"],
"patterns": [],
"dictionaries": ["markdown"],
"dictionaryDefinitions": []
}
]
"import": ["./cspell-ext.yaml"]
}
46 changes: 46 additions & 0 deletions dictionaries/markdown/cspell-ext.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
id: markdown
version: '0.2'
name: Markdown
description: Markdown dictionary for cspell.
readonly: true
dictionaryDefinitions:
# To be added when there are keywords.
# - name: markdown
# path: ./markdown.txt.gz
# description: Markdown dictionary for cspell.
patterns:
- name: MARKDOWN-link-reference
description: 'Markdown reference link: `[This is a link][reference]`, matches `[reference]`'
pattern: >-
/(?<=\])\[[-\w.`'"*&;#@ ]+\]/g
- name: MARKDOWN-link-footer
description: 'Markdown referenced link: `[reference]: https://www.google.com`, matches the entire reference.'
pattern: >-
/\[[-\w.`'"*&;#@ ]+\]:( [^\s]*)?/g
- name: MARKDOWN-link
description: 'Markdown link: `[link text](link)`, matches `link`'
pattern: >-
/(?<=\]\()[^)\s]+/g
- name: MARKDOWN-anchor
description: 'Markdown Anchors: `<a id="my_link"></a>`, matches `my_link`'
pattern: >-
/(?<=<a\s+id=")[^"\s]+/g
languageSettings:
- languageId: markdown,mdx
locale: '*'
ignoreRegExpList:
- MARKDOWN-link-reference
- MARKDOWN-link-footer
- MARKDOWN-link
- MARKDOWN-anchor
- HTML-symbol-entity
dictionaries:
- html
- html-symbol-entities
- typescript
- languageId: mdx
locale: '*'
dictionaries:
- html
- html-symbol-entities
- typescript
11 changes: 11 additions & 0 deletions dictionaries/markdown/cspell-tools.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/streetsidesoftware/cspell/main/packages/cspell-tools/cspell-tools.config.schema.json

$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/packages/cspell-tools/cspell-tools.config.schema.json
targets:
- name: markdown
targetDirectory: .
compress: true
format: plaintext
sources:
- src/markdown.txt
sort: true
11 changes: 8 additions & 3 deletions dictionaries/markdown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
"./cspell-ext.json": "./cspell-ext.json"
},
"scripts": {
"build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 cspell-tools-cli compile \"src/markdown.txt\" -o .",
"test": "pnpm run test-dict && pnpm run test-check",
"test-dict": "shx head -n 1000 \"src/markdown.txt\" | cspell -c ./cspell-ext.json \"--locale=*\" \"--languageId=markdown\" stdin",
"build": "cspell-tools-cli build",
"test": "pnpm run test-check",
"test-check": "ava",
"prepublishOnly": "echo pre-publish",
"prepare:dictionary": "pnpm run build"
Expand All @@ -40,9 +39,15 @@
"homepage": "https://github.com/streetsidesoftware/cspell-dicts/blob/main/dictionaries/markdown#readme",
"devDependencies": {},
"dependencies": {},
"peerDependencies": {
"@cspell/dict-html": "workspace:*",
"@cspell/dict-html-symbol-entities": "workspace:*",
"@cspell/dict-typescript": "workspace:*"
},
"files": [
"markdown.txt.gz",
"cspell-ext.json",
"cspell-ext.yaml",
"*.js",
"*.d.ts"
]
Expand Down
1 change: 1 addition & 0 deletions dictionaries/markdown/src/markdown.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Markdown Keywords
35 changes: 24 additions & 11 deletions pnpm-lock.yaml

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

0 comments on commit 1394c0b

Please sign in to comment.