declare namespace _exports { export { SyntaxType, FilePathsOrGlobs, ProcessFileOptions, MarkdownMagicOptions, RemoteCacheOptions, OutputConfig, MarkdownMagicResult }; } declare namespace _exports { export { markdownMagic }; export { parseMarkdown }; export { blockTransformer }; export { processFile }; export { stringUtils }; export namespace __private { export { createDependencyGraph }; } } export = _exports; /** * Allowed file syntaxes */ type SyntaxType = "md" | "js" | "yml" | "yaml"; /** * Path to file, files or Glob string or Glob Array */ type FilePathsOrGlobs = string | Array; type ProcessFileOptions = import("comment-block-replacer").ProcessFileOptions; /** * Configuration for markdown magic * * Below is the main config for `markdown-magic` */ type MarkdownMagicOptions = { /** * - Files to process. */ files?: FilePathsOrGlobs; /** * - Custom commands to transform block contents, see transforms & custom transforms sections below. */ transforms?: any; /** * - Output configuration object or directory path */ output?: OutputConfig | string; /** * - Syntax to parse */ syntax?: SyntaxType; /** * - Opening match word. Default is 'docs'. */ open?: string; /** * - Closing match word. Default is '/docs'. If not defined will be same as opening word with closing slash added. */ close?: string; /** * - Current working directory. Default process.cwd() */ cwd?: string; /** * - Flatten files that are output */ outputFlatten?: boolean; /** * - Use git glob for LARGE file directories */ useGitGlob?: boolean; /** * - See planned execution of matched blocks */ dry?: boolean; /** * - See debug details */ debug?: boolean; /** * - Silence all console output */ silent?: boolean; /** * - Log each unique remote HTTP request as it is attempted. Set false to disable. */ logRemoteRequests?: boolean; /** * - Apply transforms to source file. Default is true. */ applyTransformsToSource?: boolean; /** * - Fail if transform functions are missing. Default skip blocks. */ failOnMissingTransforms?: boolean; /** * - Fail if remote file is missing. */ failOnMissingRemote?: boolean; /** * - Allow REMOTE/CODE blocks to use GitHub tokens or gh auth for private repository files. Default is false. */ allowPrivateGithub?: boolean; /** * - Remote fetch cache options. Use false or `{ enabled: false }` to disable. */ remoteCache?: RemoteCacheOptions | boolean; /** * - GitHub resolver options. */ github?: any; /** * - Deprecated: Use `output` instead. Output directory path. */ outputDir?: string; }; /** * Remote fetch cache options */ type RemoteCacheOptions = { /** * - Enable the remote fetch cache. */ enabled?: boolean; /** * - Cache directory. Defaults to the user's OS cache directory outside the project. */ directory?: string; /** * - Milliseconds to reuse normal remote responses. Default is 5 minutes. */ ttl?: number; /** * - Milliseconds to reuse GitHub files pinned to a full 40-character commit SHA. Default is 30 days. */ immutableTtl?: number; /** * - Persist authenticated private GitHub responses. Set false to keep private reads memory-only for the current run. */ cachePrivate?: boolean; /** * - Log cache hits as remote requests marked with `(from cache)`. */ logHits?: boolean; }; /** * Optional output configuration */ type OutputConfig = { /** * - Change output path of new content. Default behavior is replacing the original file */ directory?: string; /** * - Remove comments from output. Default is false. */ removeComments?: boolean; /** * - Custom function for altering output paths */ pathFormatter?: Function; /** * - Apply transforms to source file. Default is true. This is for when outputDir is set. */ applyTransformsToSource?: boolean; }; /** * Result of markdown processing */ type MarkdownMagicResult = { /** * - Any errors encountered. */ errors: any[]; /** * - Modified files */ filesChanged: Array; /** * - md data */ results: any[]; }; /** * Allowed file syntaxes * @typedef {'md' | 'js' | 'yml' | 'yaml'} SyntaxType */ /** * Path to file, files or Glob string or Glob Array * @typedef {string|Array} FilePathsOrGlobs */ /** * @typedef {import('comment-block-replacer').ProcessFileOptions} ProcessFileOptions */ /** * Configuration for markdown magic * * Below is the main config for `markdown-magic` * * @typedef {object} MarkdownMagicOptions * @property {FilePathsOrGlobs} [files] - Files to process. * @property {Object} [transforms = defaultTransforms] - Custom commands to transform block contents, see transforms & custom transforms sections below. * @property {OutputConfig|string} [output] - Output configuration object or directory path * @property {SyntaxType} [syntax = 'md'] - Syntax to parse * @property {string} [open = 'docs'] - Opening match word. Default is 'docs'. * @property {string} [close = '/docs'] - Closing match word. Default is '/docs'. If not defined will be same as opening word with closing slash added. * @property {string} [cwd = process.cwd() ] - Current working directory. Default process.cwd() * @property {boolean} [outputFlatten] - Flatten files that are output * @property {boolean} [useGitGlob] - Use git glob for LARGE file directories * @property {boolean} [dry = false] - See planned execution of matched blocks * @property {boolean} [debug = false] - See debug details * @property {boolean} [silent = false] - Silence all console output * @property {boolean} [logRemoteRequests = true] - Log each unique remote HTTP request as it is attempted. Set false to disable. * @property {boolean} [applyTransformsToSource = true] - Apply transforms to source file. Default is true. * @property {boolean} [failOnMissingTransforms = false] - Fail if transform functions are missing. Default skip blocks. * @property {boolean} [failOnMissingRemote = true] - Fail if remote file is missing. * @property {boolean} [allowPrivateGithub = false] - Allow REMOTE/CODE blocks to use GitHub tokens or gh auth for private repository files. Default is false. * @property {RemoteCacheOptions|boolean} [remoteCache] - Remote fetch cache options. Use false or `{ enabled: false }` to disable. * @property {Object} [github] - GitHub resolver options. * @property {string} [outputDir] - Deprecated: Use `output` instead. Output directory path. */ /** * Remote fetch cache options * * @typedef {object} RemoteCacheOptions * @property {boolean} [enabled = true] - Enable the remote fetch cache. * @property {string} [directory] - Cache directory. Defaults to the user's OS cache directory outside the project. * @property {number} [ttl = 300000] - Milliseconds to reuse normal remote responses. Default is 5 minutes. * @property {number} [immutableTtl] - Milliseconds to reuse GitHub files pinned to a full 40-character commit SHA. Default is 30 days. * @property {boolean} [cachePrivate = true] - Persist authenticated private GitHub responses. Set false to keep private reads memory-only for the current run. * @property {boolean} [logHits = true] - Log cache hits as remote requests marked with `(from cache)`. */ /** * Optional output configuration * @typedef {object} OutputConfig * @property {string} [directory] - Change output path of new content. Default behavior is replacing the original file * @property {boolean} [removeComments = false] - Remove comments from output. Default is false. * @property {function} [pathFormatter] - Custom function for altering output paths * @property {boolean} [applyTransformsToSource = false] - Apply transforms to source file. Default is true. This is for when outputDir is set. */ /** * Result of markdown processing * * @typedef {object} MarkdownMagicResult * @property {Array} errors - Any errors encountered. * @property {Array} filesChanged - Modified files * @property {Array} results - md data */ /** * ### API * * Markdown Magic Instance * * ```js * markdownMagic(globOrOpts, options) * ``` * * @param {FilePathsOrGlobs|MarkdownMagicOptions} globOrOpts - Files to process or config. * @param {MarkdownMagicOptions} [options] - Markdown magic config * @returns {Promise} * @example markdownMagic(['**.**.md'], options).then((result) => { console.log(`Processing complete`, result) }) */ declare function markdownMagic(globOrOpts?: FilePathsOrGlobs | MarkdownMagicOptions, options?: MarkdownMagicOptions): Promise; import { blockTransformer } from "comment-block-transformer"; import { processFile } from "comment-block-replacer"; declare namespace stringUtils { export { stringBreak }; } /** * Create graph data for deterministic dependency ordering * @param {Array<{id: string, blocks: Array, dependencies?: Array}>} blockItems * @returns {{itemsWithBlocks: Array, itemIds: Array, graph: Array<[string, string]>}} */ declare function createDependencyGraph(blockItems?: Array<{ id: string; blocks: Array; dependencies?: Array; }>): { itemsWithBlocks: Array; itemIds: Array; graph: Array<[string, string]>; }; import stringBreak = require("./utils/string-break"); //# sourceMappingURL=index.d.ts.map