pure-systems.com syntax highlighting

For documentation pages. Example page: https://www.pure-systems.com/pv-update/additions/doc/latest/com.ps.consul.eclipse.ui.doc/ch06s14.html

  1. // ==UserScript==
  2. // @license MIT
  3. // @name pure-systems.com syntax highlighting
  4. // @namespace Violentmonkey Scripts
  5. // @match https://www.pure-systems.com/*
  6. // @grant none
  7. // @version 1.0
  8. // @author -
  9. // @description For documentation pages. Example page: https://www.pure-systems.com/pv-update/additions/doc/latest/com.ps.consul.eclipse.ui.doc/ch06s14.html
  10. // @require https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
  11. // @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js
  12. // ==/UserScript==
  13.  
  14. $("head").append('<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/default.min.css">')
  15. $(".programlisting").each(function () {
  16. if ($(this).children().length == 0) {
  17. $(this).wrapInner(document.createElement("code")) //wrap the content in a <code> tag
  18. }
  19. else {
  20. $(this).children().wrapInner(document.createElement("code")) //wrap each child's content in its own <code> tag
  21. }
  22. });
  23.  
  24. hljs.highlightAll();