Skip to content

Improve this documentation ​

The site is built with VitePress from the docs/ directory of the LIVR repository. For a small fix, use the "Edit this page on GitHub" link at the bottom of any page.

To run the site locally:

  1. Fork and clone koorchik/LIVR.
  2. Install dependencies (Node.js 20 or newer): npm install
  3. Start the dev server: npm run docs:dev
  4. Open http://localhost:5173/ and edit the files in docs/. The page reloads on save.
  5. Check the production build: npm run docs:build
  6. Open a pull request.

The site is deployed automatically from the master branch.

Useful details ​

  • The sidebar and the navigation are configured in docs/.vitepress/config.mts.

  • A fenced code block with the livr language becomes an editable live example:

    md
    ```livr
    // rules
    { name: 'required' }
    // input
    { name: '' }
    ```

    An optional // aliases section takes a list of aliases.

  • Every rule has its own page, docs/validation-rules/<rule>.md:

    • the first paragraph after the title is the summary shown on the rules overview;
    • the Error codes: line lists the codes, so the overview can be filtered by them;
    • the frontmatter sets the group, the short syntax for the overview and the live example;
    • <RuleSandbox /> renders the live example together with the rule's test suite cases.

    The groups and the order of the rules are set in docs/data/rule-groups.json. To add a rule, create its page and add it to a group.

  • <TestCases suite="aliases" /> shows the alias cases of the test suite.

  • The list of implementations is generated from docs/data/implementations.json. After changing it, run npm run readme to update the repository README.

  • Set LIVR_DOCS_OFFLINE=1 to build the site without fetching package versions and repository activity.