Skip to content

Commit

Permalink
Add ltex.markdown.ignore/dummy settings
Browse files Browse the repository at this point in the history
Fixes #26.
  • Loading branch information
valentjn committed Feb 29, 2020
1 parent df16440 commit a9f7460
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## 4.7.9 (upcoming)

- Update the Markdown parser flexmark-java to 0.60.2; this increases the speed of parsing Markdown
- Add possibility to ignore Markdown elements or replace them by dummy words via `ltex.markdown.ignore` and `ltex.markdown.dummy` (fixes [#26][#26])
- Ignore Markdown code blocks by default
- Replace auto-links and inline Markdown code with dummy words by default
- Fix match positions were sometimes off by one, especially in Markdown documents
- Rewrite `MarkdownAnnotatedTextBuilder`

Expand Down Expand Up @@ -181,4 +184,5 @@
[#23]: https://github.com/valentjn/vscode-ltex/issues/23
[#24]: https://github.com/valentjn/vscode-ltex/issues/24
[#25]: https://github.com/valentjn/vscode-ltex/issues/25
[#26]: https://github.com/valentjn/vscode-ltex/issues/26
[ltls#1]: https://github.com/valentjn/languagetool-languageserver/issues/1
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ This extension contributes the following settings. Some settings are separated b
* `ltex.environments.ignore`: List of additional L<sup>A</sup>T<sub>E</sub>X environments to be ignored by the L<sup>A</sup>T<sub>E</sub>X parser.
* Example: `["lstlisting", "verbatim"]` (although these two environments are already ignored by default); default: `[]`

* `ltex.markdown.ignore`: List of Markdown node types to be ignored by the Markdown parser. The Markdown parser constructs an AST (abstract syntax tree) for the Markdown document, in which all leaves have node type `Text`. LT<sub>E</sub>X will ignore all nodes (and their `Text` leaves) that have one of the listed node types. The possible node types are listed at <https://javadoc.io/static/com.vladsch.flexmark/flexmark/0.60.2/com/vladsch/flexmark/ast/package-summary.html>.
* Example: `["CodeBlock", "FencedCodeBlock", "IndentedCodeBlock"]` (default)

* `ltex.markdown.dummy`: List of Markdown node types to be replaced by dummy words (i.e., `Dummy0`, `Dummy1`, etc.) by the Markdown parser. LT<sub>E</sub>X internally uses this mechanism for example for links and inline code that are part of the sentence structure and for which LanguageTool would throw an error if simply omitted from the checked text. The possible node types are listed at <https://javadoc.io/static/com.vladsch.flexmark/flexmark/0.60.2/com/vladsch/flexmark/ast/package-summary.html>.
* Example: `["AutoLink", "Code"]` (default)

* `ltex.ignoreRuleInSentence`: Individual rule/sentence pairs to ignore, i.e., no diagnostics of the specified rule will be displayed for the specified sentence. Add sentences by using the `Ignore in this sentence` quick fix.
* Example: `[{"rule": "THIS_NNS", "sentence": "^\\QThese error in this sentence should be ignored.\\E$"}]`; default: `[]`

Expand Down
2 changes: 1 addition & 1 deletion lib/languagetool-languageserver
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,27 @@
"verbatim"
]
},
"ltex.markdown.ignore": {
"type": "array",
"scope": "resource",
"default": [
"CodeBlock",
"FencedCodeBlock",
"IndentedCodeBlock"
],
"markdownDescription": "List of Markdown node types to be ignored by the Markdown parser. The Markdown parser constructs an AST (abstract syntax tree) for the Markdown document, in which all leaves have node type `Text`. LT<sub>E</sub>X will ignore all nodes (and their `Text` leaves) that have one of the listed node types. The possible node types are listed at <https://javadoc.io/static/com.vladsch.flexmark/flexmark/0.60.2/com/vladsch/flexmark/ast/package-summary.html>.",
"description": "List of Markdown node types to be ignored by the Markdown parser. The Markdown parser constructs an AST (abstract syntax tree) for the Markdown document, in which all leaves have node type \"Text\". LTe>X will ignore all nodes (and their \"Text\" leaves) that have one of the listed node types. The possible node types are listed at https://javadoc.io/static/com.vladsch.flexmark/flexmark/0.60.2/com/vladsch/flexmark/ast/package-summary.html."
},
"ltex.markdown.dummy": {
"type": "array",
"scope": "resource",
"default": [
"AutoLink",
"Code"
],
"markdownDescription": "List of Markdown node types to be replaced by dummy words (i.e., `Dummy0`, `Dummy1`, etc.) by the Markdown parser. LT<sub>E</sub>X internally uses this mechanism for example for inline code (inside backticks) that is part of the sentence structure and for which LanguageTool would throw an error if simply omitted from the checked text. The possible node types are listed at <https://javadoc.io/static/com.vladsch.flexmark/flexmark/0.60.2/com/vladsch/flexmark/ast/package-summary.html>.",
"description": "List of Markdown node types to be replaced by dummy words (i.e., \"Dummy0\", \"Dummy1\", etc.) by the Markdown parser. LTeX internally uses this mechanism for example for inline code (inside backticks) that is part of the sentence structure and for which LanguageTool would throw an error if simply omitted from the checked text. The possible node types are listed at https://javadoc.io/static/com.vladsch.flexmark/flexmark/0.60.2/com/vladsch/flexmark/ast/package-summary.html."
},
"ltex.ignoreRuleInSentence": {
"type": "array",
"scope": "resource",
Expand Down

0 comments on commit a9f7460

Please sign in to comment.