Uploaded image for project: 'Maven Skins'
  1. Maven Skins
  2. MSKINS-242

Replace deprecated prettify JS library

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • fluido-2.0.0
    • Fluido Skin
    • None

    Description

      The JS library used for code highlighting in https://github.com/apache/maven-fluido-skin/blob/master/src/main/resources/js/prettify.js seems to be based on the legacy library
      https://github.com/googlearchive/code-prettify (unclear which version). As that is no longer maintained since quite a while we should switch.

      One alternative is hightlight.js(compare also with https://meta.stackexchange.com/questions/353983/goodbye-prettify-hello-highlight-js-swapping-out-our-syntax-highlighter).

      Attachments

        Issue Links

          Activity

            hightlight.js does not come with line number capabilities (https://highlightjs.readthedocs.io/en/latest/line-numbers.html) but there are plugins for that (e.g. https://github.com/wcoder/highlightjs-line-numbers.js).

            kwin Konrad Windszus added a comment - hightlight.js does not come with line number capabilities ( https://highlightjs.readthedocs.io/en/latest/line-numbers.html ) but there are plugins for that (e.g. https://github.com/wcoder/highlightjs-line-numbers.js ).
            michael-o Michael Osipov added a comment -

            I looked into this, not too much work, but here is the big question:

            • Which themes to include?
            • Which languages to include?

            All of them will make the output quite huge...

            michael-o Michael Osipov added a comment - I looked into this, not too much work, but here is the big question: Which themes to include? Which languages to include? All of them will make the output quite huge...
            kwin Konrad Windszus added a comment - - edited

            We should probably consider what is currently supported via prettify: https://github.com/googlearchive/code-prettify?tab=readme-ov-file#for-which-languages-does-it-work although I would disregard all non-web, non-java, non-script languages. That basically boils down to

            1. java
            2. xml
            3. json
            4. bash
            5. javascript

            We can easily extend support later on if necessary (removing is more difficult).

            As style I would just ship `default.min.css` (https://highlightjs.org/demo#lang=&v=1&theme=default-min).

            kwin Konrad Windszus added a comment - - edited We should probably consider what is currently supported via prettify: https://github.com/googlearchive/code-prettify?tab=readme-ov-file#for-which-languages-does-it-work although I would disregard all non-web, non-java, non-script languages. That basically boils down to java xml json bash javascript We can easily extend support later on if necessary (removing is more difficult). As style I would just ship `default.min.css` ( https://highlightjs.org/demo#lang=&v=1&theme=default-min ).
            githubbot ASF GitHub Bot added a comment -

            michael-o commented on PR #65:
            URL: https://github.com/apache/maven-fluido-skin/pull/65#issuecomment-2336766340

            This draft includes these languages:
            "bash.js"
            "bash.min.js"
            "diff.js"
            "diff.min.js"
            "java.js"
            "java.min.js"
            "json.js"
            "json.min.js"
            "powershell.js"
            "powershell.min.js"
            "shell.js"
            "shell.min.js"
            "xml.js"
            "xml.min.js"

            githubbot ASF GitHub Bot added a comment - michael-o commented on PR #65: URL: https://github.com/apache/maven-fluido-skin/pull/65#issuecomment-2336766340 This draft includes these languages: "bash.js" "bash.min.js" "diff.js" "diff.min.js" "java.js" "java.min.js" "json.js" "json.min.js" "powershell.js" "powershell.min.js" "shell.js" "shell.min.js" "xml.js" "xml.min.js"
            githubbot ASF GitHub Bot added a comment -

            kwin commented on code in PR #65:
            URL: https://github.com/apache/maven-fluido-skin/pull/65#discussion_r1756202191

            ##########
            pom.xml:
            ##########
            @@ -136,11 +137,13 @@ under the License.
            <!

            githubbot ASF GitHub Bot added a comment - kwin commented on code in PR #65: URL: https://github.com/apache/maven-fluido-skin/pull/65#discussion_r1756202191 ########## pom.xml: ########## @@ -136,11 +137,13 @@ under the License. <!
            githubbot ASF GitHub Bot added a comment -

            michael-o commented on code in PR #65:
            URL: https://github.com/apache/maven-fluido-skin/pull/65#discussion_r1759203476

            ##########
            src/main/resources/META-INF/maven/site-macros.vm:
            ##########
            @@ -48,7 +48,7 @@
            #**##end
            #end
            ##
            -#macro( link $link $icon = false $omitImage = false $elemOnEmptyHref = "a" $dotSlashOnEmptyHref = false $imageClass = "imageLink" $overrideElemClass = false )
            +#macro( link $link $iconClass = null $omitImage = false $elemOnEmptyHref = "a" $dotSlashOnEmptyHref = null $imageClass = "imageLink" $overrideElemClass = null )

            Review Comment:
            This looks like a bug in GH, ignore it.

            githubbot ASF GitHub Bot added a comment - michael-o commented on code in PR #65: URL: https://github.com/apache/maven-fluido-skin/pull/65#discussion_r1759203476 ########## src/main/resources/META-INF/maven/site-macros.vm: ########## @@ -48,7 +48,7 @@ #**##end #end ## -#macro( link $link $icon = false $omitImage = false $elemOnEmptyHref = "a" $dotSlashOnEmptyHref = false $imageClass = "imageLink" $overrideElemClass = false ) +#macro( link $link $iconClass = null $omitImage = false $elemOnEmptyHref = "a" $dotSlashOnEmptyHref = null $imageClass = "imageLink" $overrideElemClass = null ) Review Comment: This looks like a bug in GH, ignore it.

            People

              Unassigned Unassigned
              kwin Konrad Windszus
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: