Skip to content

ndi.docs.all_documents2markdown

 ALL_DOCUMENTS2MARKDOWN Recursively convert all NDI document types to Markdown.

    t = ndi.docs.all_documents2markdown(Name, Value, ...)

    This function recursively scans a source directory (`input_path`) for NDI 
    document `.json` files. It converts each document into a Markdown file and 
    saves it to a destination directory (`output_path`).

    Simultaneously, it generates a YAML-formatted string that maps the document
    titles to their relative locations (`doc_output_path`), suitable for building a
    table of contents in documentation systems like MkDocs.

    ## Path Variable Roles
    * **`input_path`**: The source folder on your computer where the function
        looks for the original `.json` document files.
    * **`output_path`**: The destination folder on your computer where the
        function will write the converted `.md` markdown files.
    * **`doc_output_path`**: A relative path string used to construct the URL links
        within the generated `documents.yml` file. This should match the path
        structure of your documentation site.

    ## Name-Value Pairs
    **'spaces'** (default: `6`)
        A non-negative integer for the number of spaces to indent the current 
        level in the output YAML string.

    **'input_path'** (default: `ndi.common.PathConstants.DocumentFolder`)
        The full path to the directory to search for `.json` files.

    **'output_path'** (default: `.../docs/NDI-matlab/documents/`)
        The full path to the directory where generated `.md` files will be saved.

    **'doc_output_path'** (default: `'NDI-matlab/documents/'`)
        The relative URL path prefix for documents in the generated YAML file.

    **'write_yml'** (default: `true`)
        A logical flag (`true` or `false`) indicating whether to write the
        `documents.yml` file. This is automatically set to `false` in recursive calls.

    ## Outputs
    **t**
        A character vector containing the generated YAML content.

    ## Example
    ```matlab
    % Generate all markdown files using default paths.
    yml_text = ndi.docs.all_documents2markdown();
    ```