### Install Dependencies Source: https://github.com/doclang-project/doclang/blob/main/CONTRIBUTING.md Installs all project dependencies, including development and CI groups, for local development. ```bash uv sync ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/doclang-project/doclang/blob/main/CONTRIBUTING.md Installs pre-commit hooks locally to ensure code quality before committing. ```bash uv run pre-commit install ``` -------------------------------- ### Install DocLang Validator Source: https://github.com/doclang-project/doclang/blob/main/README.md Install the DocLang validator using pip. This command installs the package and its dependencies. ```bash pip install doclang ``` -------------------------------- ### Simple Key-Values Example Source: https://github.com/doclang-project/doclang/blob/main/spec.md A basic example of key-value pairs within a field region, often used for forms. ```xml Firma: Holcim ... GmbH Datum: 23.08.2019 Petrograph. Typ: Quartiarer Sand + Kies ``` -------------------------------- ### Inline Cross-Reference Example Source: https://github.com/doclang-project/doclang/blob/main/spec.md Demonstrates how to create an inline cross-reference to a thread using the element. ```xml ... is shown in Figure 3 . The desired balance... ``` -------------------------------- ### Schematron Rule Example Source: https://github.com/doclang-project/doclang/blob/main/doclang/README.md An example of a Schematron rule written in XML. This demonstrates how to define custom validation assertions using XPath. ```xml Error message ``` -------------------------------- ### Basic Hyperlink Example Source: https://github.com/doclang-project/doclang/blob/main/spec.md Shows how to create a basic hyperlink to a URI using the element within a text element. ```xml Visit our website for more information. ``` -------------------------------- ### Inline Formula Example Source: https://github.com/doclang-project/doclang/blob/main/spec.md Display inline mathematical formulas using the 'formula' tag. ```latex E = mc^2 ``` ```latex \sin x \approx x - x^3/3! ``` ```latex (a+b)^n = \sum_{k=0}^n \binom{n}{k} a^{n-k} b^k ``` -------------------------------- ### DocLang Document Structure Example Source: https://github.com/doclang-project/doclang/blob/main/spec.md Demonstrates the DocLang head and body scheme for both the document and individual elements, including metadata and content. ```xml Hello world! Headless paragraph ``` -------------------------------- ### Block Formula Example Source: https://github.com/doclang-project/doclang/blob/main/spec.md Display a standalone mathematical formula. ```latex \int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi} ``` -------------------------------- ### Run CI Checks Source: https://github.com/doclang-project/doclang/blob/main/CONTRIBUTING.md Installs only the CI-specific dependencies and runs pre-commit hooks for code quality checks. ```bash uv sync --frozen --no-default-groups --group ci pre-commit run --all-files ``` -------------------------------- ### Fillable Form Example Source: https://github.com/doclang-project/doclang/blob/main/examples/form/form-examples.md Shows a form structure designed for user input, with fields for description, quantity, pricing, and delivery details. Some fields are intentionally left blank for user input. ```xml Description A.A. Cat Quant. Un Measure Price (in currency) Un Total Delivery Cost Maintenance Date and time of delivery: Guarantee Delivery Suppl...Finance Department ``` -------------------------------- ### Inline Code Example Source: https://github.com/doclang-project/doclang/blob/main/spec.md Display inline code using the 'code' tag. Supports nested formatting like bold. ```xml Check your version with python --version. We can even have formatted code. ``` -------------------------------- ### DocLang Head Metadata Example Source: https://github.com/doclang-project/doclang/blob/main/spec.md This XML snippet demonstrates the usage of reserved core metadata elements within the section of a DocLang document, including title, author information, date, language, topic, document hash, summary, generation information, and page size configurations. It also shows examples of custom governance and compliance metadata. ```xml My Company's Annual Report Author 1 Name Affiliation A Affiliation B Author 2 Name 2024-01-01 eng spa Technology Math 75f2db0c6124527bf6dd48440f95fc864a5108d28517633f937923a7d8199185 This is a summary of the document example_vlm_org/example_vlm_name 0.1 0.1 0.1 ``` -------------------------------- ### Shell Code Block - Part 2 Source: https://github.com/doclang-project/doclang/blob/main/spec.md Continuation of a multi-page shell script example, linked by thread ID. ```shell echo "done" ``` -------------------------------- ### Consolidated DocLang Head Example Source: https://github.com/doclang-project/doclang/blob/main/spec.md This XML snippet defines a complete DocLang head, integrating controls for PII, data extraction, RAG, and document training. Implementations can use this as a default or override specific components. ```xml Customer Support Case File 2025-01-15 eng example_pipeline/doc_ingest_v2 https://www.apache.org/licenses/LICENSE-2.0 confidential personal information Customer support automation Internal analytics GDPR ISO/IEC 27001 ISO/IEC 27701 present medium user_provided controller case_resolution legitimate_interest applied pseudonymized low restricted no_general_training not_permitted support_case_records true false true true tables_and_forms_only case_metrics field_level false false redact internal_systems_only false true 90 true true true summaries_only max_512_tokens support_intent_only true summarize_and_redact false false false true 30 true 90 enterprise_internal_models false none none none false false false false true true 365 ``` -------------------------------- ### Basic Text Formatting Source: https://github.com/doclang-project/doclang/blob/main/spec.md Provides examples of basic text formatting tags including bold, italic, underline, and strikethrough. ```xml This text contains bold, italic, underlined, and struck-through text. ``` -------------------------------- ### XML Element with Attributes Source: https://github.com/doclang-project/doclang/blob/main/spec.md An example of an XML element with properties defined as attributes. ```xml foo ``` -------------------------------- ### Table with Caption Source: https://github.com/doclang-project/doclang/blob/main/spec.md An example of a DocLang table that includes a caption to describe its content, along with location data. ```xml MethodAccuracy Baseline0.85 Proposed0.92
Table 1: Experimental Results
``` -------------------------------- ### Basic Field Region Example Source: https://github.com/doclang-project/doclang/blob/main/spec.md This snippet shows a basic XML structure for a field region with multiple field items. ```xml Description A.A. Cat Quant. Un Measure Price (in currency) Un Total Delivery Cost Maintenance Date and time of delivery: Guarantee Delivery Suppl...Finance Department ``` -------------------------------- ### Generate Reference Data Source: https://github.com/doclang-project/doclang/blob/main/CONTRIBUTING.md Generates the reference data, including Appendix A in spec.md, from input Excel files and example DocLang files. ```bash uv run python utils/generate_reference.py reference/input ``` -------------------------------- ### Shell Code Block - Part 1 Source: https://github.com/doclang-project/doclang/blob/main/spec.md First part of a multi-page shell script example, identified by a thread ID. ```shell # Part 1 seq 1 5 | while read n; do echo $n; done ``` -------------------------------- ### High Density Form Example Source: https://github.com/doclang-project/doclang/blob/main/spec.md This snippet shows a dense XML structure for a form, including multiple field headings and items with markers. ```xml M31 REDDITI DI CAPITALE SOGGETTI AD IMPOSIZIONE SOSTITUTIVA 1 Tipo 2 Codice Stato estero 3 Ammontare reddito ,00 4 Aliquota % 5 Credito IVCA ,00 6 Proventi particolari 7 Opzione tassazione ordinaria M32 PROVENTI DELLE OBBLIGAZIONI NON ASSOGGETTATI A IMPOSTA SOSTITUTIVA 1 Ammontare reddito ,00 2 Aliquota % ``` -------------------------------- ### Form Elements for Field Items Source: https://github.com/doclang-project/doclang/blob/main/examples/form/form-examples.md This XML snippet defines individual form items, each with a key, an optional value, and a hint. These are referenced by the tabular form example. ```xml *FORM1*: 300EUR *FORM2*: 400EUR *FORM4*: 401 *FORM5*: 302 *FORM3*: 301 *FORM6*: 402 *FORM7*: 309 *FORM8*: 409 ``` -------------------------------- ### Prepare Release Source: https://github.com/doclang-project/doclang/blob/main/CONTRIBUTING.md Prepares for a new release by syncing versions, regenerating reference data, and creating Word exports. An optional reference input path can be provided. ```bash uv run python utils/prepare_release.py TARGET_VERSION # syncs version across artifacts, regenerates Appendix A, writes DOCX exports, and prepends a section to CHANGELOG.md; optional "--reference-input reference/input") ``` -------------------------------- ### Fillable Fields with Hints Source: https://github.com/doclang-project/doclang/blob/main/spec.md Demonstrates fillable fields using the 'fillable' class and provides hints for user input. ```xml Application Form Full Name: Enter your first and last name Date of Birth: Format: YYYY-MM-DD Email Address: example@domain.com Status: Pending Review ``` -------------------------------- ### CLI Help Source: https://github.com/doclang-project/doclang/blob/main/doclang/README.md Display the help message for the doclang CLI tool. This shows all available commands and options. ```bash doclang --help ``` -------------------------------- ### Simple Document Structure Source: https://github.com/doclang-project/doclang/blob/main/spec.md Demonstrates a basic DocLang document with a flat list of elements including headings, and text. This is the most straightforward way to structure content. ```xml Research Paper Title Abstract This paper presents... Introduction In recent years... Background Previous work has shown... ``` -------------------------------- ### Simple Key-Value Form Fields Source: https://github.com/doclang-project/doclang/blob/main/examples/form/form-examples.md Illustrates a basic form structure with key-value pairs for simple data entry. ```xml Firma: Holcim ... GmbH Datum: 23.08.2019 Petrograph. Typ: Quartiarer Sand + Kies ``` -------------------------------- ### Unordered List with Optional Markers Source: https://github.com/doclang-project/doclang/blob/main/spec.md Demonstrates an unordered list with optional bullet markers and text content that can include formatting. ```xml First item with bold text Second item ``` -------------------------------- ### Export to Word Source: https://github.com/doclang-project/doclang/blob/main/CONTRIBUTING.md Exports the main specification (spec.md) to a Word document. ```bash uv run python utils/export_docx.py ``` -------------------------------- ### DocLang XML Namespace Declaration Source: https://github.com/doclang-project/doclang/blob/main/doclang/README.md Example of a DocLang XML document with the required namespace declaration. This is necessary for VS Code's XML extension to correctly associate the XSD. ```xml ``` -------------------------------- ### Run Full Test Suite Source: https://github.com/doclang-project/doclang/blob/main/CONTRIBUTING.md Executes the complete test suite using pytest. ```bash uv run pytest ``` -------------------------------- ### Page Break with Simple Continuation Source: https://github.com/doclang-project/doclang/blob/main/spec.md Demonstrates how to handle content that spans across a page break using and elements to maintain continuity. ```xml Some caption This paragraph spans across multiple pages. ``` -------------------------------- ### Nested Form Structure with Headings Source: https://github.com/doclang-project/doclang/blob/main/examples/form/form-examples.md Demonstrates how to create nested form regions and use field headings to organize information, particularly for transport details. ```xml 14. Transport Information Land transport ... (Germany) GGVS/GGVE class: 8 ADR/RID class: 8 River transport ADN/ADNR not examined Sea transport IMDG The transport ... considered. THESE TRANSPORT ... PACK! ``` -------------------------------- ### Basic Table with Virtual Text Source: https://github.com/doclang-project/doclang/blob/main/spec.md A simple DocLang table structure using virtual text content within cells. ```xml MethodAccuracy Baseline0.8 Proposed0.92
``` -------------------------------- ### Table with Location and Semantic Elements Source: https://github.com/doclang-project/doclang/blob/main/spec.md Demonstrates a DocLang table with explicit location attributes and semantic elements for Method and Accuracy. ```xml MethodAccuracy Baseline0.85 Proposed0.92
``` -------------------------------- ### Superscript and Subscript Formatting Source: https://github.com/doclang-project/doclang/blob/main/spec.md Illustrates the use of and tags for creating superscript and subscript text, commonly used in numbers and formulas. ```xml 1st question: What is the formula for water? Answer: H2O. ``` -------------------------------- ### Nested Lists (Ordered and Unordered) Source: https://github.com/doclang-project/doclang/blob/main/spec.md Shows how to nest lists, mixing ordered and unordered list types within a parent list. ```xml 1. Setup project Create virtual environment Configure linter 2. Implement features ``` -------------------------------- ### Basic Split Text Structure Source: https://github.com/doclang-project/doclang/blob/main/spec.md Illustrates the fundamental XML structure for splitting a text item across multiple sections using thread IDs. ```xml This text item starts here and continues here. ``` -------------------------------- ### Nested Text Formatting Source: https://github.com/doclang-project/doclang/blob/main/spec.md Demonstrates how to combine different text formatting tags, such as bold with italic or underlined with bold. ```xml You can combine bold and italic or underlined and bold text. ``` -------------------------------- ### Form with Headings and Fields Source: https://github.com/doclang-project/doclang/blob/main/spec.md This snippet demonstrates using field headings to structure form content, followed by individual field items. ```xml Information about you *Family Name (Last Name) staar *Given Name (First Name) peter *Middle Name (if applicable) WJ I am in the United States as a: Visitor Student Permanent Resident Other (Specify) Country of Citizenship *Date of Birth Alien Registration Number (A-Number) (if any) A- Information About Your Address *Present Physical Address ()No Po Boxes *Street ... Name Apt. Ste. ``` -------------------------------- ### Table with Rich Cells (List, Nested Table, Image) Source: https://github.com/doclang-project/doclang/blob/main/spec.md Illustrates a DocLang table with complex cell content, including lists, a nested table, and an image element. ```xml DescriptionDetails Pipeline steps Ingest Process Export Nested table
Table 3: Rich Cells
Key Value A 1 B 2
Inner table
Image Example image inside a cell ``` -------------------------------- ### DocLang Governance Flowchart Source: https://github.com/doclang-project/doclang/blob/main/spec.md Illustrates the mapping of four governance areas (Privacy & PII, Extraction, RAG, Training) to common document-to-AI workflows, showing how governance metadata travels with the document to inform downstream systems. ```mermaid flowchart LR D["Document content
(DocLang body)"] --> H["
Governance metadata"] H --> PII["Privacy & PII controls
(pii_*)"] H --> EXT["Extraction controls
(extraction_*)"] H --> RAG["RAG controls
(rag_*)"] H --> TRN["Training controls
(training_*)"] D --> X["Extraction pipeline"] EXT --> X PII --> X X --> XD["Extracted dataset / fields"] D --> I["Index/Embed pipeline"] RAG --> I PII --> I I --> E["Embeddings / index"] E --> Q["Retrieve"] RAG --> Q Q --> M["Model inference"] M --> O["Output"] RAG --> O PII --> O D --> T["Training / fine-tuning pipeline"] TRN --> T PII --> T T --> TD["Training dataset"] T --> TM["Trained model"] ``` -------------------------------- ### List Split Across Pages Source: https://github.com/doclang-project/doclang/blob/main/spec.md Illustrates how to handle lists that span multiple pages using elements to indicate continuation. ```xml 1. First item 2. Second item 3. Third item ``` -------------------------------- ### Custom Vocabulary without XML Namespace Source: https://github.com/doclang-project/doclang/blob/main/spec.md Demonstrates using a project-specific prefix for custom vocabulary elements when formal XML namespaces are not required, such as for local usage. ```xml ``` -------------------------------- ### Custom Vocabulary with XML Namespace Source: https://github.com/doclang-project/doclang/blob/main/spec.md Shows how to use a formal XML namespace for custom vocabularies, exemplified by capturing a chemistry structure in SMILES format. ```xml ``` -------------------------------- ### Form with Personal and Address Information Source: https://github.com/doclang-project/doclang/blob/main/examples/form/form-examples.md Demonstrates using form headings to structure personal details and address information. Includes fields for names, citizenship, date of birth, and physical address. ```xml Information about you *Family Name (Last Name) staar *Given Name (First Name) peter *Middle Name (if applicable) WJ I am in the United States as a: Visitor Student Permanent Resident Other (Specify) Country of Citizenship *Date of Birth Alien Registration Number (A-Number) (if any) A- Information About Your Address *Present Physical Address ()No Po Boxes *Street ... Name Apt. Ste. ``` -------------------------------- ### Picture by Reference URI Source: https://github.com/doclang-project/doclang/blob/main/spec.md Embed a picture using a reference URI. ```xml ``` -------------------------------- ### Single List Item Broken by Page Break Source: https://github.com/doclang-project/doclang/blob/main/spec.md Demonstrates how to split a single list item across pages using elements for both the list and the item content. ```xml This item starts on page 1 and continues on page 2 until it ends. ``` -------------------------------- ### Checkbox List Items Source: https://github.com/doclang-project/doclang/blob/main/spec.md A list demonstrating checkbox items with selectable states (selected/unselected). Markers are optional. ```xml Completed task Pending task ``` -------------------------------- ### Formula with Caption and Coordinates Source: https://github.com/doclang-project/doclang/blob/main/spec.md Display a formula with a caption and specified coordinates. ```latex f(x) = \frac{1}{\sigma\sqrt{2\pi}}\,\exp\!\left(-\frac{(x-\mu)^2}{2\sigma^2}\right) ``` -------------------------------- ### Bar Chart with Tabular Data Source: https://github.com/doclang-project/doclang/blob/main/spec.md Create a bar chart using a class, label, and tabular data for structure. ```xml ``` -------------------------------- ### Basic CLI Validation Source: https://github.com/doclang-project/doclang/blob/main/doclang/README.md Perform basic validation of a DocLang XML file using the command-line interface. This command checks the document against default validation rules. ```bash doclang validate my_document.dclg.xml ``` -------------------------------- ### Basic List with Virtual Text Source: https://github.com/doclang-project/doclang/blob/main/spec.md A simple list where list items contain unwrapped text content, treated as virtual elements. ```xml First item Second item Third item ``` -------------------------------- ### DocLang Element with Properties as Elements Source: https://github.com/doclang-project/doclang/blob/main/spec.md DocLang's alternative representation for properties, using dedicated child elements for LLM-friendliness. ```xml 250#ffeeddfoo ```