bit-docs/lib/process/file module

Processes a file's source using any registered processors.

processFile(filename, source, docMap, siteConfig)

Passes the file source (and other data) to any registered processors like:

Also passes a ProcessorCallback that processors can use to add DocObjects to the DocMap.

Parameters

  1. filename {String}:

    The filename.

  2. source {FileSource}:

    The file's source.

  3. docMap {DocMap}:

    DocMap being added to.

  4. siteConfig {Object}:

    Global site config.

    • tags {TagCollection}

      If siteConfig or siteConfig.tags is not provided, the default tags will be used.

Use

var processFile = require('bit-docs/lib/process/file');
var docMap = {};
var siteConfig = {};
processFile(
  "myproject.js",
  "import $ from 'jquery' ... ",
  docMap,
  siteConfig
);

Falls back to default processor bit-docs-process-tags if no processor was able to process.

For .js code files, each block will be processed individually by bit-docs-js/process/codeAndComment.

For other files like .md, processors will process the file source as one big block.