Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chalin/code-excerpter
A line-based utility for extracting code regions.
https://github.com/chalin/code-excerpter
Last synced: about 1 month ago
JSON representation
A line-based utility for extracting code regions.
- Host: GitHub
- URL: https://github.com/chalin/code-excerpter
- Owner: chalin
- License: bsd-2-clause
- Created: 2018-03-14T19:52:07.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-11T16:46:14.000Z (over 6 years ago)
- Last Synced: 2024-10-20T08:52:39.351Z (2 months ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# code-excerpter
A line-based utility for extracting code regions.
## Command line usage
`code-excerpter [path-to-dir-or-file-to-excerpt-from]`
## API
```js
var excerpter = require('code-excerpter');
var options = { /* see below, but at a minimum: */
examplesDir: 'path to base of folder from which excerpts are generated',
fragmentsDir: 'path to base of folder where fragment files will be placed',
};
var fileOrDirToExcerptFrom = /* path to file or directory */;excerpter.excerpt(options, fileOrDirToExcerptFrom)
```## Options and default values
```
// Whether old fragments should be deleted before new ones are generated:
clean: false,// Path to base directory containing files from which excerpts will be created:
examplesDir: "_examples",// Array of string, of glob patterns of files to search for code excerpt markers:
extns: ['*.css', '*.dart', '*.html', '*.js', '*.json', '*.scss', '*.ts', '*.yaml', '*.yml',],// Excerpts get copied here with same subdir structure:
fragmentsDir: "_fragments",// String, or array of string, of glob patterns of files to ignor:
ignore: ['**/node_modules/**', '**/dist/**', '**/build/packages/**', '**/build/test/**', '**/build/web/**', '**/.*/**'],// Whether to process subdirectories under examplesDir:
recursive: true,// Log level, one of 'debug', 'info', 'warn', or 'error':
logLevel: 'warn',
```