diff --git a/www/src/components/Layout.tsx b/www/src/components/Layout.tsx index fc170c06..46f582ec 100644 --- a/www/src/components/Layout.tsx +++ b/www/src/components/Layout.tsx @@ -1,7 +1,7 @@ import { MDXProvider } from '@mdx-js/react'; import styled, { css } from 'astroturf/react'; -import React, { useState } from 'react'; import { Link } from 'gatsby'; +import React, { useState } from 'react'; import CodeBlock from './CodeBlock'; @@ -56,7 +56,7 @@ function Layout(props: Props) { }} >
{ + // Capture as liberally as possible, including things like `h-(screen-1.5)` + const broadMatches = content.match(/[^<>"'`\s]*[^,<>"'`\s:]/g) || []; + const broadMatchesWithoutTrailingSlash = broadMatches.map((match) => + match.replace(/\\\\$/, ''), + ); + + // Capture classes within other delimiters like .block(class="w-1/2") in Pug + const innerMatches = + content.match(/[^<>"'`\s.(){}[\]#=%]*[^<>"'`\s.(){}[\]#=%:]/g) || []; + + return broadMatches + .concat(broadMatchesWithoutTrailingSlash) + .concat(innerMatches); + }, + }, + }, theme: { fontFamily: { brand: 'Fontdiner Swanky',