code-input icon indicating copy to clipboard operation
code-input copied to clipboard

language attr and classes set to "none" in all cases

Open Devastatia opened this issue 1 year ago • 2 comments

The language attribute is ignored regardless of what I set it to ("HTML", "html", "CSS", etc.)

code-input.language is set to "none"

pre and code classes both set to "language-none"

The attached screenshot tells all.

code-input-screenshot

Devastatia avatar May 10 '24 16:05 Devastatia

Curiously, it works as expected when Prism is replaced with highlight.js.

Devastatia avatar May 10 '24 17:05 Devastatia

Quick Workaround (code-input demo)

@Devastatia, The bug should disappear if you add language="none" as an HTML attribute in the markup of the code-input element (or via JavaScript to the code-input element as soon as it is created).


Properly Fixing

There seems to be a problem with these lines of code:

https://github.com/WebCoder49/code-input/blob/c068194690575c04e9c15f9c5b4a23fd8dc3d741/code-input.js#L760-L764

I'm afraid I'm quite busy right now but the bug's scope being restricted to Prism suggests it might be due to Prism's functionality of adding the language-none class, which is not part of highlight.js. I will be available shortly after 25 May and will look at this bug more then.

Clearly, if you know how to fix it, comments / a pull request are very welcome, but not required.

WebCoder49 avatar May 10 '24 18:05 WebCoder49