Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hidegh opened this issue Mar 2, 2021 · 2 comments · May be fixed by #90
Labels
enhancement New feature or request

Comments

@hidegh
Copy link

hidegh commented Mar 2, 2021

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, ...

@zachleat zachleat added the enhancement New feature or request label Jun 28, 2022
@edwardhorsford
Copy link

Came here for similar. I'm attempting to alias nunjucks to jinja2 or twig or django, and this seemed the appropriate way. However if I log the keys of Prism.languages a variable amount are output each time.

@vrugtehagel
Copy link

This would also great for using css-extras, since it is not itself a language but rather enhances css. In other words, you cannot autoload css-extras, and so you'd want to be able to specify it manually in your config.

@vrugtehagel vrugtehagel linked a pull request Aug 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants