Skip to content

Markdown highlighting throws error #13

@idleberg

Description

@idleberg

Consider the following demo code:

const markdown = `
# Demo

Markdown supports *italic* and **bold** text among other things
`.trim();

console.log(chromafi(markdown, {lang: 'markdown'}));

This will produce the following error:

~/Demo/node_modules/chromafi/index.js:74
			return opts.colors[color](childText)
			                         ^

TypeError: opts.colors[color] is not a function
    at filter (~/Demo/node_modules/chromafi/index.js:74:29)
    at ~/Demo/node_modules/chromafi/index.js:71:48
    at Array.map (<anonymous>)
    at filter (~/Demo/node_modules/chromafi/index.js:71:31)
    at ~/Demo/node_modules/chromafi/index.js:146:16
    at Array.forEach (<anonymous>)
    at syntaxHlStr (~/Demo/node_modules/chromafi/index.js:143:8)
    at chromafi (~/Demo/node_modules/chromafi/index.js:387:11)
    at Object.<anonymous> (~/Demo/demo.js:9:13)
    at Module._compile (internal/modules/cjs/loader.js:759:30)

This seems to be specific to Markdown since {lang: 'html'} works just fine.

Node v12.0.0
macOS 10.14.6 (18G103)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions