Skip to content

BUG / FR / documentation: prism loading - possibility to load other languages; other prism components;  #47

Open
@hidegh

Description

@hidegh

When adding the plugin and trying extending languages, only a few are available. Later on other languages will be accessible.

This is IMO a bug.

Adding new languages - init should be called after all other languages are loaded by the plugin (or prismjs)

Features I miss (some might just need documentation to be added):

  • default language fallback (text) - at least for MD
  • possibility to add aliases for languages
  • possibility to tell which languages get's loaded
  • also which components are loaded (like line highlight, line numbering, etc... although some might need extra plugin code)
    eleventyConfig.addPlugin(syntaxHighlight, {
        init: function({ Prism }) {
            
            Prism.languages.console = Prism.languages.extend('markup', {});
            Prism.languages.terminal = Prism.languages.extend('markup', {});
            console.log('init', Object.keys(Prism.languages))
        }
    });
init [
  'extend',   'insertBefore',
  'DFS',      'markup',
  'html',     'mathml',
  'svg',      'xml',
  'ssml',     'atom',
  'rss',      'css',
  'clike',    'javascript',
  'js',       'console',
  'terminal'
]

Later on languages include more: ruby,rb,yaml,yml,markdown,md,liquid,bash,shell,java,python,py

But still missing: cs, sql, ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions