Browse Source

Merge pull request #7627 from weseek/imprv/omit-clobber-prefix

imprv: Omit clobber prefix
Yuki Takei 2 years ago
parent
commit
6315bb7f3e

+ 5 - 4
apps/app/src/components/ReactMarkdownComponents/NextLink.tsx

@@ -28,13 +28,14 @@ const isAttached = (href: string): boolean => {
 
 type Props = Omit<LinkProps, 'href'> & {
   children: React.ReactNode,
+  id?: string,
   href?: string,
   className?: string,
 };
 
 export const NextLink = (props: Props): JSX.Element => {
   const {
-    href, children, className, ...rest
+    id, href, children, className, ...rest
   } = props;
 
   const { data: siteUrl } = useSiteUrl();
@@ -51,13 +52,13 @@ export const NextLink = (props: Props): JSX.Element => {
   // when href is an anchor link
   if (isAnchorLink(href)) {
     return (
-      <a href={href} className={className} {...dataAttributes}>{children}</a>
+      <a id={id} href={href} className={className} {...dataAttributes}>{children}</a>
     );
   }
 
   if (isExternalLink(href, siteUrl)) {
     return (
-      <a href={href} className={className} target="_blank" rel="noopener noreferrer" {...dataAttributes}>
+      <a id={id} href={href} className={className} target="_blank" rel="noopener noreferrer" {...dataAttributes}>
         {children}&nbsp;<i className='icon-share-alt small'></i>
       </a>
     );
@@ -68,7 +69,7 @@ export const NextLink = (props: Props): JSX.Element => {
     const dlhref = href.replace('/attachment/', '/download/');
     return (
       <span>
-        <a href={href} className={className} target="_blank" rel="noopener noreferrer" {...dataAttributes}>
+        <a id={id} href={href} className={className} target="_blank" rel="noopener noreferrer" {...dataAttributes}>
           {children}
         </a>&nbsp;
         <a href={dlhref} className="attachment-download"><i className='icon-cloud-download'></i></a>

+ 3 - 3
apps/app/src/services/renderer/renderer.tsx

@@ -49,7 +49,7 @@ export const commonSanitizeOption: SanitizeOption = deepmerge(
   rehypeSanitizeDefaultSchema,
   baseSanitizeSchema,
   {
-    clobberPrefix: 'mdcont-',
+    clobberPrefix: '', // remove clobber prefix
   },
 );
 
@@ -93,14 +93,14 @@ export const verifySanitizePlugin = (options: RendererOptions, shouldBeTheLastIt
 export const generateCommonOptions = (pagePath: string|undefined): RendererOptions => {
   return {
     remarkPlugins: [
-      [toc, { maxDepth: 3, tight: true, prefix: 'mdcont-' }],
+      [toc, { maxDepth: 3, tight: true }],
       gfm,
       emoji,
       pukiwikiLikeLinker,
       growiDirective,
     ],
     remarkRehypeOptions: {
-      clobberPrefix: 'mdcont-',
+      clobberPrefix: '', // remove clobber prefix
       allowDangerousHtml: true,
     },
     rehypePlugins: [

+ 1 - 1
apps/app/test/cypress/integration/20-basic-features/20-basic-features--access-to-page.spec.ts

@@ -35,7 +35,7 @@ context('Access to page', () => {
     // remove animation for screenshot
     // remove 'blink' class because ::after element cannot be operated
     // https://stackoverflow.com/questions/5041494/selecting-and-manipulating-css-pseudo-elements-such-as-before-and-after-usin/21709814#21709814
-    cy.get('#mdcont-headers').invoke('removeClass', 'blink');
+    cy.get('#headers').invoke('removeClass', 'blink');
 
     cy.collapseSidebar(true);
     cy.screenshot(`${ssPrefix}-sandbox-headers`);

+ 1 - 1
apps/app/test/cypress/integration/21-basic-features-for-guest/21-basic-features-for-guest--access-to-page.spec.ts

@@ -20,7 +20,7 @@ context('Access to page by guest', () => {
     // remove animation for screenshot
     // remove 'blink' class because ::after element cannot be operated
     // https://stackoverflow.com/questions/5041494/selecting-and-manipulating-css-pseudo-elements-such-as-before-and-after-usin/21709814#21709814
-    cy.get('#mdcont-headers').invoke('removeClass', 'blink');
+    cy.get('#headers').invoke('removeClass', 'blink');
 
     cy.screenshot(`${ssPrefix}-sandbox-headers`);
   });