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

Support <pre><code> tags. #14

Open
2brownc opened this issue Jul 6, 2021 · 3 comments
Open

Support <pre><code> tags. #14

2brownc opened this issue Jul 6, 2021 · 3 comments

Comments

@2brownc
Copy link

2brownc commented Jul 6, 2021

Currently microlight class needs to be included in the class list. But most syntax highlight scripts automatically work on code wrapped in <pre><code> tags.

I request same behavior with microlight.js.

@Qix-
Copy link

Qix- commented Jul 6, 2021

What would be better is:

https://github.com/asvd/microlight/blob/master/microlight.js#L39-L41

Changing this to:

-     var reset = function(cls) {
+     var reset = function(nodes) {
         // nodes to highlight
-        microlighted = _document.getElementsByClassName(cls||'microlight');
+        microlighted = nodes || _document.getElementsByClassName('microlight');

And then release as a major version bump.

This would solve all problems in a way that is trivially backwards compatible.

@gurugeek
Copy link

Following @Qix- Idea I modified it to highlight all automatically

	var reset = function(nodes) {
        microlighted = document.getElementsByTagName("code");

you can find the fork here
https://github.com/gurugeek/microlight/blob/master/microlight.js

@Qix-
Copy link

Qix- commented Dec 17, 2021

@gurugeek your change does not do what I suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants