0.0.19 • Published 2 years ago

mdod v0.0.19

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

mdod - Markdown On Demand

NPM Version Build Status Downloads Stats

README & DOCS TODO

Installation

npm badge

TODO

Developing

yarn gen-readme // update README.md
yarn docs // update DOCUMENTATION.md
yarn test // lint & mocha
yarn update-deps // bump all deps

Release History

See CHANGELOG.md for more information.

License

Distributed under the MIT license. See LICENSE.md for more information.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

API Reference

The standalone JSDoc reference can be found in DOCUMENTATION.md

Classes

Constants

Functions

Typedefs

FSAccessError ⇐ Error

Filesystem access error, providing the inaccessible path in the error message.

Kind: global class
Extends: Error

new FSAccessError(path, origError)

Creates a new error object.

ParamTypeDescription
pathstringpath that was deemed inaccessible
origErrorErrororiginal error, if any

fsAccessError.getPath() ⇒ string

Returns the inaccessible path.

Kind: instance method of FSAccessError
Returns: string - path - path that was deemed inaccessible

HLJSHighlightAutoError ⇐ HLJSHighlightError

Represents an error encountered when automatically highlighting an input string with highlight.js.

Kind: global class
Extends: HLJSHighlightError

new HLJSHighlightAutoError(lang, str, origError)

Creates a new HLJSHighlightAutoError object.

ParamTypeDescription
langstringsource language
strstringsource
origErrorErrororiginal error, if any

hljsHighlightAutoError.getString() ⇒ string

Returns the string that triggered the error.

Kind: instance method of HLJSHighlightAutoError
Overrides: getString
Returns: string - str

HLJSHighlightError ⇐ Error

Represents an error encountered when highlighting an input string with an explicit language via highlight.js.

Kind: global class
Extends: Error

new HLJSHighlightError(lang, str, origError)

Creates a new HLJSHighlightAutoError object.

ParamTypeDescription
langstringsource language
strstringsource
origErrorErrororiginal error, if any

hljsHighlightError.getString() ⇒ string

Returns the string that triggered the error.

Kind: instance method of HLJSHighlightError
Returns: string - str

VALID_MARKDOWN_EXTENSIONS : Array.<string>

Valid markdown extensions. Currently .md and .markdown are considered.

Kind: global constant

renderCommandHandler(args)

Renders markdown files to HTML based on passed parameters.

Kind: global function

ParamTypeDefaultDescription
argsobject{}arguments
args.overwritebooleanfalseif true, existing files are overwritten
args.hiddenbooleantrueif false, hidden files (names starting with a '.') will not be rendered
args.deststringdestination directory to write HTML output too
args.srcstringsource path to read markdown files from
args.recursivestringif directories are to be searched for further renderable files.

renderFile(args) ⇒ Promise.<RenderableFile>

Renders a single markdown file to HTML.

Kind: global function
Returns: Promise.<RenderableFile> - p

ParamTypeDefaultDescription
argsObject{}args
args.fileFSFilefile to render
args.srcPathstringsource path
args.destPathstringdestination path
args.overwritebooleanoverwrite existing files

ensurePath(dirPath) ⇒ Promise

Ensures the specified path is accessible.

Kind: global function
Returns: Promise - p - resolves on success
Throws:

ParamTypeDefaultDescription
dirPathstring"''"path to check

getFilesInDirectoryByExts(args) ⇒ Promise.<Array.<string>>

Returns all markdown files in the specified directory as fs nodes. By default considers files with '.md' or '.markdown' extensions.

Kind: global function
Returns: Promise.<Array.<string>> - p
Throws:

  • Error if the directory is not accessible.
ParamTypeDefaultDescription
argsobject{}args - args
args.dirPathstring"''"path to search for markdown files in
args.allowHiddenbooleanfalseif true, includes hidden files (prefixed with a '.') in results.
args.extsArray.<string>extensions to filter for
args.recursivebooleanif true, recurses into subdirectories

getMdFilesInDirectory(args) ⇒ Promise.<Array.<string>>

Returns markdown files in the requested directory. Optionally recurses.

Kind: global function
Returns: Promise.<Array.<string>> - p
See: getFilesInDirectoryByExts
Todo

  • add a typedef for the shared arguments
ParamTypeDefaultDescription
argsobject{}args, @see getFilesInDirectoryByExts

getNodesInDirectory(args) ⇒ Promise.<DirectoryNodes>

Returns an array of filenames in the specified directory.

Kind: global function
Returns: Promise.<DirectoryNodes> - p
Throws:

ParamTypeDefaultDescription
argsobject{}args
args.dirPathstring"''"directory to read
args.recursivebooleanfalseif true, recurses into subdirectories
args.filesbooleantrueallows files in res
args.directoriesbooleantrueallows directories in res
args.allowHiddenbooleanfalseif true, includes hidden files (prefixed with a '.') in res.

RenderableFile

Kind: global typedef
Properties

NameTypeDescription
filePathstringpath for the source file
fileDestPathstringpath for the rendered file
fileSourceMDstringsource file markdown content
fileHTMLstringrendered file HTML content
fileRenderDurationMTSnumbermilliseconds to render
fileRenderedbooleantrue if the destination file was written

DirectoryNodes

Kind: global typedef
Properties

NameTypeDescription
dirPathstringbase path for all file & directory names
filesArray.<string>array of filenames
directoriesArray.<string>array of directory names
0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago