• TypeScript 99.8%
  • JavaScript 0.2%
Find a file
DigiToegankelijk NLdoc ecae017e22 Merge branch 'renovate/redocly-cli-2.x-lockfile' into 'main'
chore(deps): update dependency @redocly/cli to v2.14.2

See merge request logius/nldoc/spec/document!404
2025-12-30 20:17:12 +00:00
.vscode feat: use @toegang-voor-iedereen/configs package 2024-08-26 17:49:36 +02:00
src chore: fix linting issue 2025-08-18 11:50:48 +02:00
test fix: filter empty example sets 2025-04-23 13:58:22 +02:00
.editorconfig chore: set .editorconfig 2025-04-22 01:05:55 +00:00
.gitignore feat: add versioning 2024-07-30 14:28:39 +02:00
.gitlab-ci.yml fix: linting stuff and dependencies 2025-04-03 21:52:02 +02:00
.npmrc fix: update references (GitLab migration) 2025-04-03 21:21:12 +02:00
.nvmrc chore(deps): update node.js to v24 2025-11-02 01:12:14 +00:00
.prettierignore chore: update version and lint project 2024-08-27 16:17:06 +02:00
.releaserc feat: publish package 2024-08-27 17:58:00 +02:00
CHANGELOG.md chore(release): 7.0.58 2025-05-27 11:17:44 +00:00
CODEOWNERS chore: set CODEOWNERS 2025-04-22 00:25:36 +00:00
eslint.config.mjs fix: update references (GitLab migration) 2025-04-03 21:21:12 +02:00
example-generator.yaml chore: merge main 2024-08-27 11:59:11 +02:00
index.ts fix: import assertion -> with 2025-04-03 21:45:25 +02:00
LICENSE chore: Add LICENSE 2024-11-18 13:41:15 +00:00
package-lock.json chore(deps): update dependency @redocly/cli to v2.14.2 2025-12-30 20:09:43 +00:00
package.json chore(deps): update node.js to v24 2025-11-02 01:12:14 +00:00
prettier.config.mjs fix: update references (GitLab migration) 2025-04-03 21:21:12 +02:00
README.md docs: update readme 2025-08-18 11:35:11 +02:00
renovate.json chore: npm install twice 2025-11-05 14:07:44 +00:00
tsconfig.dist.json fix: expose examples through index 2024-08-28 14:35:46 +02:00
tsconfig.json fix: expose examples through index 2024-08-28 14:35:46 +02:00

NLdoc Document Specification

pipeline status coverage report Latest Release NPM Version

An OpenAPI 3.1.0 compatible specification for describing digital documents. This TypeScript library provides a comprehensive schema framework for representing document structure, content, and metadata.

Overview

This specification defines a standardized schema for describing various types of digital documents including:

  • Structured content (headings, paragraphs, lists, tables)
  • Multimedia elements (images, assets)
  • Document metadata and annotations (footnotes, citations)
  • Complex document layouts (nested structures, definition lists)

The specification provides a consistent, type-safe way to describe and structure digital documents, enabling better document management, processing, and integration with document processing systems.

Getting Started

Prerequisites

  • Node.js >= 22.0.0 < 23.0.0
  • npm >= 10.0.0 < 12.0.0

Installation

Install the package via npm:

npm install @nldoc/document-specification

Or using yarn:

yarn add @nldoc/document-specification

Basic Usage

import {
  specification,
  validExamples,
  invalidExamples
} from '@nldoc/document-specification';

// Access the OpenAPI specification
console.log(specification);

// Use valid examples for testing
console.log(validExamples);

// Use invalid examples for validation testing
console.log(invalidExamples);

Accessing the OpenAPI Specification

After building the project, the complete OpenAPI 3.1.0 specification is available at:

# Build the project first
npm run build

# The OpenAPI specification is now available at:
# - public/openapi.json (JSON format)
# - public/index.html (Interactive HTML documentation)

Development

Local Setup

  1. Clone the repository:

    git clone https://gitlab.com/logius/nldoc/spec/document.git
    cd document-specification
    
  2. Install dependencies:

    npm install
    
  3. Build the project:

    npm run build
    

Available Scripts

  • npm run test - Run the test suite with Vitest
  • npm run build - Build the OpenAPI specification, examples, and TypeScript files
  • npm run lint - Lint the codebase using ESLint
  • npm run format - Format code using Prettier
  • npm run format:check - Check code formatting
  • npm run fix - Auto-fix linting and formatting issues
  • npm run lint:openapi - Generate an HTML report for the OpenAPI specification

Building Components

The build process consists of several steps:

  1. OpenAPI Generation: npm run build:openapi - Generates the OpenAPI JSON specification
  2. Example Extraction: npm run build:examples - Extracts valid and invalid test examples
  3. TypeScript Compilation: Compiles TypeScript to JavaScript for distribution
  4. Documentation: npm run build:redocly - Generates HTML documentation using Redocly

Document Types

The specification supports various document elements:

Core Resources

  • Document: The root document container
  • Asset: External resources (images, files, etc.)
  • Footnote: Document footnotes and references

Text Elements

  • Heading: Document headings (H1-H6)
  • Paragraph: Text paragraphs with inline content
  • Text: Plain text content
  • Link: Hyperlinks

Structural Elements

  • Table: Tables with headers, rows, and cells
  • OrderedList/UnorderedList: Numbered and bulleted lists
  • DefinitionList: Term-definition pairs
  • BlockQuotation: Quoted content blocks
  • Preformatted: Pre-formatted text blocks

Media Elements

  • Image: Image resources with metadata

API Documentation

The generated OpenAPI specification can be viewed:

  1. Locally: After building, open public/index.html in your browser
  2. Online: View the latest release documentation

Testing

Run the test suite:

npm test

Contributing

We welcome contributions! Please ensure:

  1. All tests pass (npm test)
  2. Code is properly formatted (npm run format:check)
  3. Linting rules are followed (npm run lint)
  4. OpenAPI specification is valid (npm run lint:openapi)

License

This project is licensed under the European Union Public License 1.2 - see LICENSE for details.

Acknowledgements