Skip to content

bad error reporting for improper headers #17

@dherman

Description

@dherman

When an .md file has improperly indented headers it seems to crash the JS code and report an internal error. For example, running codex on a project with a file containing the following:


---
title: Home

---

Hello, world.

produces the error:

/Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/node_modules/yaml/lib/yaml.js:179
  throw new Error(msg + ', ' + context(this.peek()[1].input))
        ^
Error: document not properly dedented, near "\n---"
    at Parser.expect (/Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/node_modules/yaml/lib/yaml.js:179:9)
    at Parser.parseDoc (/Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/node_modules/yaml/lib/yaml.js:266:8)
    at Parser.parse (/Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/node_modules/yaml/lib/yaml.js:232:19)
    at Object.eval (/Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/node_modules/yaml/lib/yaml.js:384:46)
    at /Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/lib/codex/plugins/pages.js:33:26
    at Array.forEach (native)
    at /Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/lib/codex/plugins/pages.js:16:13
    at /Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/lib/codex/plugins/pages.js:79:29
    at /Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/lib/codex/plugins/pages.js:79:29
    at Object.oncomplete (/Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/lib/codex/plugins/pages.js:85:27)

Dave

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions