Skip to content

Selecting a specific language with the autodetect plugin #122

Open
@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

    area:existing-pluginA bug/feature for an existing plugin in the plugins folder of code-input.enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions