版博士V2.0程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

22 regels
550 B

  1. (function () {
  2. if (typeof Prism === 'undefined' || typeof document === 'undefined') {
  3. return;
  4. }
  5. Prism.hooks.add('before-sanity-check', function (env) {
  6. if (env.code) {
  7. var pre = env.element.parentNode;
  8. var clsReg = /(?:^|\s)keep-initial-line-feed(?:\s|$)/;
  9. if (
  10. pre && pre.nodeName.toLowerCase() === 'pre' &&
  11. // Apply only if nor the <pre> or the <code> have the class
  12. (!clsReg.test(pre.className) && !clsReg.test(env.element.className))
  13. ) {
  14. env.code = env.code.replace(/^(?:\r?\n|\r)/, '');
  15. }
  16. }
  17. });
  18. }());