Skip to content

Selecting a specific language with the autodetect plugin #122

@nikita51bot

Description

@nikita51bot

Hi, I'm just getting started with code-input and I have a question, how can I select a specific language when the autodetect plugin is registered?

    <script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
    <link rel="stylesheet"
        href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/default.min.css">
    </link>

    <script src="https://cdn.jsdelivr.net/gh/WebCoder49/[email protected]/code-input.js"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/[email protected]/code-input.min.css">

    <script src="https://cdn.jsdelivr.net/gh/WebCoder49/[email protected]/plugins/autodetect.min.js"></script>
        

    <script>
        codeInput.registerTemplate("syntax-highlighted",
            codeInput.templates.hljs(
                hljs,
                [
                    new codeInput.plugins.Autodetect(),
                ]
            )
        );
    </script>

I've tried adding the tag language="HTML" to the code-input block, but it automatically changes to the language the plugin has defined. Thanks in advance for the answer!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions