Skip to content

Commit e9f6491

Browse files
authored
Merge pull request #17 from hawkeyexl/add-url-support
Let file-path and template-path arguments accept URLs
2 parents 642050c + 335e1b4 commit e9f6491

File tree

12 files changed

+649
-114
lines changed

12 files changed

+649
-114
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818

1919
- name: Install dependencies
2020
run: npm ci
21+
env:
22+
DOC_STRUCTURE_LINT_PRELOAD: 1
2123

2224
- name: Run tests
2325
run: npm test

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ A tool to validate Markdown document structure against specified templates, ensu
2929
npx doc-structure-lint --file-path path/to/doc.md --template path/to/template.yaml
3030
```
3131

32-
Doc Structure Lint uses a _local_ language model to evaluate some parts of your templates and content. This model only takes about 2 GB of storage, and it's only downloaded once. When you run the tool for the first time, it may take a few minutes to download the language model. If you don't want to download the model during installation, set the `DOC_STRUCTURE_LINT_PRELOAD` environment variable to `0`. However, if you specify an `instructions` property in your template, the model will be downloaded regardless of the `DOC_STRUCTURE_LINT_PRELOAD` variable value.
32+
Doc Structure Lint uses a _local_ language model to evaluate the `instructions` rules of your templates. This model only takes about 2 GB of storage, and it's only downloaded once. The first time you run the tool with a template that uses `instructions`, it may take a few minutes to download the language model. If you want to preload the model during installation, set the `DOC_STRUCTURE_LINT_PRELOAD` environment variable to `1`.
3333

3434
```bash
35-
export DOC_STRUCTURE_LINT_PRELOAD=0 && npx doc-structure-lint --file-path path/to/doc.md --template path/to/template.yaml
35+
export DOC_STRUCTURE_LINT_PRELOAD=1 && npx doc-structure-lint --file-path path/to/doc.md --template path/to/template.yaml
3636
```
3737

3838
### Options
3939

40-
- `--file-path` or `-f`: Path to the Markdown document to validate
41-
- `--template-path` or `-p`: Path to the YAML template file (default: `./template.yaml`)
40+
- `--file-path` or `-f`: URL or path to the content to lint. Local paths can be individual files or directories.
41+
- `--template-path` or `-p`: URL or path to the template file (default: `./template.yaml`).
4242
- `--template` or `-t`: Name of the template to use
4343
- `--json`: Output results in JSON format
4444

@@ -57,16 +57,16 @@ import { lintDocument } from "doc-structure-lint";
5757

5858
async function validateDocument() {
5959
const result = await lintDocument({
60-
file: "path/to/doc.md",
61-
templatePath: "path/to/template.yaml",
62-
template: "Template name",
60+
file: "path/to/doc.md", // Path or URL. Doesn't support directories.
61+
templatePath: "path/to/template.yaml", // Path or URL
62+
template: "Template name", // Name of the template to use
6363
});
6464
}
6565
```
6666

6767
## Template Format
6868

69-
Templates are defined in YAML and specify the structure and content requirements for your documents. Each template can contain multiple sections with various validation rules.
69+
Templates are defined in YAML (as shown here) or JSON and specify the structure and content requirements for your documents. Each template can contain multiple sections with various validation rules.
7070

7171
Template definitions also support referencing with the `$ref` key, allowing you to reuse common section definitions across multiple templates.
7272

package-lock.json

Lines changed: 59 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "doc-structure-lint",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"description": "A tool to validate Markdown and AsciiDoc structure against a specified template",
55
"bin": {
66
"doc-structure-lint": "src/index.js"
@@ -20,7 +20,9 @@
2020
"@apidevtools/json-schema-ref-parser": "^11.7.3",
2121
"ajv": "^8.17.1",
2222
"asciidoctor": "^3.0.4",
23-
"node-llama-cpp": "^3.3.0",
23+
"axios": "^1.7.9",
24+
"crypto": "^1.0.1",
25+
"node-llama-cpp": "^3.3.1",
2426
"remark": "^15.0.1",
2527
"remark-frontmatter": "^5.0.0",
2628
"uuid": "^11.0.3",

0 commit comments

Comments
 (0)