import NextLink from 'next/link'; import { forwardRef, type AnchorHTMLAttributes, type ForwardRefRenderFunction, type ReactNode, } from 'react'; import styles from './link.module.scss'; export type LinkProps = Omit< AnchorHTMLAttributes, 'children' | 'download' | 'hrefLang' | 'lang' > & { /** * The link body. */ children: ReactNode; /** * Should we disable the default transition on links? * * @default false */ disableTransition?: boolean; /** * True if it is a download link. * * @default false */ isDownload?: boolean; /** * True if it is an external link. * * @default false */ isExternal?: boolean; /** * The link target. */ href: string; /** * The link target code language. */ lang?: string; }; const LinkWithRef: ForwardRefRenderFunction = ( { children, className = '', disableTransition = false, isDownload = false, isExternal = false, href, lang, rel = '', ...props }, ref ) => { const LinkComponent = isExternal ? 'a' : NextLink; const linkClass = [ styles.link, styles[disableTransition ? '' : 'link--regular'], styles[isDownload ? 'link--download' : ''], styles[isExternal ? 'link--external' : ''], className, ].join(' '); const linkRel = isExternal && !rel.includes('external') ? `external ${rel}` : rel; return ( {children} ); }; /** * Link Component * * Render a link. */ export const Link = forwardRef(LinkWithRef); om/commit/public/prism/prism-jsonp.min.js?h=v2.0.0&id=f349437f7ed3d110ec609ab0bf5c622b6a4dfdb8'>commitdiffstats
blob: edb2c957208d77f78fa3bf98ad27eaf68b0f8c04 (plain)
1
2
3
4
5
6
(Prism.languages.jsonp = Prism.languages.extend('json', {
  punctuation: /[{}[\]();,.]/,
})),
  Prism.languages.insertBefore('jsonp', 'punctuation', {
    function: /(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*\()/,
  });