Skip to content

Commit

Permalink
Refactor docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Nov 1, 2023
1 parent 74e3a84 commit 940b143
Show file tree
Hide file tree
Showing 3 changed files with 204 additions and 117 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* @typedef {import('lowlight').LanguageFn} LanguageFn
* @typedef {import('./lib/index.js').AutoOptions} AutoOptions
* @typedef {import('./lib/index.js').Result} Result
* @typedef {import('./lib/index.js').Sheet} Sheet
*/

Expand Down
29 changes: 23 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,37 @@
* Result.
* @property {string | undefined} language
* Detected programming language.
* @property {number | undefined} relevance
* How sure `lowlight` is that the given code is in the language.
* @property {string} value
* Highlighted code.
* @property {number | undefined} relevance
* Relevance: how sure `lowlight` is that the given code is in the language.
*
* @typedef {Record<string, Style>} Sheet
* Sheet.
* Map `highlight.js` classes to styles functions.
*
* The `hljs-` prefix must not be used in those classes.
* The “descendant selector” (a space) is supported.
*
* For convenience [chalk’s chaining of styles][styles] is suggested.
* An abbreviated example is as follows:
*
* ```js
* {
* 'comment': chalk.gray,
* 'meta meta-string': chalk.cyan,
* 'meta keyword': chalk.magenta,
* 'emphasis': chalk.italic,
* 'strong': chalk.bold,
* 'formula': chalk.inverse
* }
* ```
*
* @callback Style
* Style.
* Color something.
* @param {string} value
* Value.
* Input.
* @returns {string}
* Result.
* Output.
*/

import {Chalk} from 'chalk'
Expand Down
Loading

0 comments on commit 940b143

Please sign in to comment.