### Installation and Basic Usage (Bash) Source: https://context7.com/azu/textlint-rule-spellcheck-tech-word/llms.txt This section provides the necessary bash commands to install the textlint package along with the spellcheck-tech-word rule. It also shows how to run textlint to check a markdown file and how to automatically fix detected errors. ```bash # Install textlint and the rule npm install --save-dev textlint textlint-rule-spellcheck-tech-word # Check a markdown file textlint --rule spellcheck-tech-word README.md # Automatically fix errors textlint --fix --rule spellcheck-tech-word README.md ``` -------------------------------- ### Configure textlint scripts in package.json (JSON) Source: https://context7.com/azu/textlint-rule-spellcheck-tech-word/llms.txt This JSON configuration adds lint and fix scripts to package.json for automating textlint with the spellcheck-tech-word rule across all markdown files. It depends on textlint and the specific rule package as devDependencies. Inputs are none (part of project setup), outputs are updated package.json, and it works in npm scripts for CI/CD integration. ```json { "name": "your-project", "scripts": { "lint": "textlint --rule spellcheck-tech-word **/*.md", "lint:fix": "textlint --fix --rule spellcheck-tech-word **/*.md" }, "devDependencies": { "textlint": "^6.0.1", "textlint-rule-spellcheck-tech-word": "^5.0.0" } } ``` -------------------------------- ### Japanese Technical Writing Example Test (JavaScript) Source: https://context7.com/azu/textlint-rule-spellcheck-tech-word/llms.txt This JavaScript code demonstrates a test case for the textlint-rule-spellcheck-tech-word using TextLintTester, specifically for Japanese text containing English technical terms. It verifies that the rule correctly identifies and suggests corrections for terms like 'webkit' to 'WebKit'. ```javascript ``` -------------------------------- ### Run textlint spellcheck on files (Bash) Source: https://context7.com/azu/textlint-rule-spellcheck-tech-word/llms.txt This command demonstrates running textlint with the spellcheck-tech-word rule on a markdown file to detect and report spelling errors in technical terms. It requires textlint installed with the rule as a dependency. Input is one or more files, output is error messages with suggestions, and it can fix errors automatically with the --fix flag. ```bash $ textlint --rule spellcheck-tech-word README.md README.md 3:4 error Java Script => JavaScript ✖ 1 problem (1 error, 0 warnings) ✖ 1 fixable problem. Try to run: $ textlint --fix [file] ``` -------------------------------- ### Detecting Multiple Errors in Text (JavaScript) Source: https://context7.com/azu/textlint-rule-spellcheck-tech-word/llms.txt This JavaScript code snippet demonstrates how to use TextLintTester to run test cases for the spellcheck-tech-word rule. It shows an example of detecting multiple technical term errors within a document, including line and column information for each error. ```javascript // Example test case showing error detection const TextLintTester = require("textlint-tester"); const tester = new TextLintTester(); const rule = require("textlint-rule-spellcheck-tech-word"); tester.run("spellcheck-tech-word", rule, { invalid: [ { text: "git is a tool.\ntexlint check your texts.\nbrowserify is bundler.\n", output: "Git is a tool.\ntexlint check your texts.\nBrowserify is bundler.\n", errors: [ { message: "git => Git", line: 1, column: 1 }, { message: "browserify => Browserify", line: 3, column: 1 } ] } ] }); ``` -------------------------------- ### Test valid technical terms in textlint rule (JavaScript) Source: https://context7.com/azu/textlint-rule-spellcheck-tech-word/llms.txt This JavaScript code example shows testing the spellcheck-tech-word rule with valid technical terms to ensure they are not flagged as errors. It uses a tester.run function, likely from a testing framework like textlint's own tests. Input is an array of strings, output is test results, and it respects rules like skipping emphasized text. ```javascript tester.run("spellcheck-tech-word", rule, { valid: [ "HTML Imports", // Correct plural form "_HTML Import_" // Skipped in emphasis ] }); ``` -------------------------------- ### Main Rule Function: reporter(context) (JavaScript) Source: https://context7.com/azu/textlint-rule-spellcheck-tech-word/llms.txt The reporter function is the core of the textlint rule. It processes text nodes, using RuleHelper to skip specific elements like links and blockquotes, and spellCheckText to validate technical terms. It reports errors with potential fixes. ```javascript const RuleHelper = require("textlint-rule-helper").RuleHelper; const spellCheck = require("spellcheck-technical-word").spellCheckText; function reporter(context) { var helper = new RuleHelper(context); var fixer = context.fixer; var Syntax = context.Syntax; return { [context.Syntax.Str]: function (node) { // Skip checking in links, images, blockquotes, emphasis if (helper.isChildNode(node, [Syntax.Link, Syntax.Image, Syntax.BlockQuote, Syntax.Emphasis])) { return; } var text = context.getSource(node); var results = spellCheck(text); results.forEach(function (result) { var fixCommand = fixer.replaceTextRange([ result.paddingIndex, result.paddingIndex + result.actual.length ], result.expected); context.report(node, new context.RuleError( result.actual + " => " + result.expected, { index: result.paddingIndex, fix: fixCommand } )); }); } }; } ``` -------------------------------- ### textlint Rule Module Export (JavaScript) Source: https://context7.com/azu/textlint-rule-spellcheck-tech-word/llms.txt This snippet shows how the textlint-rule-spellcheck-tech-word module exports its linter and fixer functions, conforming to the textlint rule API. It accepts a RuleContext and returns an object with syntax handlers for processing text nodes. ```javascript const rule = require("textlint-rule-spellcheck-tech-word"); // Used internally by textlint // rule.linter - function for detecting errors // rule.fixer - function for fixing errors (same as linter with fix commands) module.exports = { linter: reporter, // Detects spelling errors fixer: reporter // Provides automatic fixes }; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.