From 15f3f14096d9a1624ac09ca73928617a2c303a75 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Mon, 9 Nov 2020 15:09:42 -0500 Subject: [PATCH] Tweak code wrapping in tables (#16406) * tweak code wrapping * empty commit to rerun ci --- javascripts/wrap-code-terms.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/javascripts/wrap-code-terms.js b/javascripts/wrap-code-terms.js index c28a30320ca6..95d07b23062b 100644 --- a/javascripts/wrap-code-terms.js +++ b/javascripts/wrap-code-terms.js @@ -1,7 +1,8 @@ -const wordsLongerThan18Chars = /[\w:/\\]{18,}/g +const wordsLongerThan18Chars = /[\S]{18,}/g const camelCaseChars = /([a-z])([A-Z])/g const underscoresAfter12thChar = /([\w:]{12}[^_]*?)_/g const slashChars = /([/\\])/g +const { escape } = require('lodash') // This module improves table rendering on reference pages by inserting a // tag in code terms that use camelcase, slashes, or underscores, inspired by @@ -12,7 +13,7 @@ export default function () { codeTerms.forEach(node => { // Do the wrapping on the inner text only, so we don't modify hrefs - const oldText = node.textContent + const oldText = escape(node.textContent) const newText = oldText.replace(wordsLongerThan18Chars, (str) => { return str