Skip to content

Commit

Permalink
repo sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Octomerger authored Nov 9, 2020
2 parents dbb9b12 + e75abc3 commit dcef1de
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions javascripts/wrap-code-terms.js
Original file line number Diff line number Diff line change
@@ -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 <wbr>
// tag in code terms that use camelcase, slashes, or underscores, inspired by
Expand All @@ -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
Expand Down

0 comments on commit dcef1de

Please sign in to comment.