Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imprv: Omit clobber prefix #7627

Merged
merged 5 commits into from
May 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions apps/app/src/components/ReactMarkdownComponents/NextLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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>
);
Expand All @@ -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>
Expand Down
6 changes: 3 additions & 3 deletions apps/app/src/services/renderer/renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const commonSanitizeOption: SanitizeOption = deepmerge(
rehypeSanitizeDefaultSchema,
baseSanitizeSchema,
{
clobberPrefix: 'mdcont-',
clobberPrefix: '', // remove clobber prefix
},
);

Expand Down Expand Up @@ -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: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
});
Expand Down