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

Improved the design of TableOfContent custom tag. #650

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
63 changes: 34 additions & 29 deletions components/StyledMarkdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@
);
},
},
th: {
th: {

Check failure on line 268 in components/StyledMarkdown.tsx

View workflow job for this annotation

GitHub Actions / Linting, Formatting and Type checking

Expected indentation of 12 spaces but found 11

Check failure on line 268 in components/StyledMarkdown.tsx

View workflow job for this annotation

GitHub Actions / Linting, Formatting and Type checking

Insert `·`
component: ({ children }) => (
<th className='border border-slate-300 dark:text-white p-4 dark:bg-slate-900 font-semibold text-black'>
{children}
Expand Down Expand Up @@ -495,7 +495,7 @@
const fullMarkdown = useContext(FullMarkdownContext);
if (!fullMarkdown) return null;
return (
<div className='text-blue-500 mt-3 bg-slate-50 dark:bg-slate-900 pt-6 pb-3 px-3 rounded-l border-l-blue-400 border-l-[3px]'>
<div className='text-blue-500 mt-3 bg-slate-50 dark:bg-slate-900 pt-6 pb-3 pr-3 rounded-l border-l-blue-400 border-l-[3px]'>
<TableOfContentMarkdown
markdown={fullMarkdown}
depth={depth}
Expand Down Expand Up @@ -530,8 +530,9 @@
return (
<a
href={`#${slug}`}
className='block cursor-pointer mb-3 text-sm leading-4 text-slate-700 hover:text-blue-500'
className='block cursor-pointer mb-3 text-sm leading-4 ml-[-0.40rem] text-slate-700 font-bold hover:text-blue-500'
>
<span className='mr-1 text-blue-400' style={{ fontSize: '1.5em' }}>&#9679;</span>

Check failure on line 535 in components/StyledMarkdown.tsx

View workflow job for this annotation

GitHub Actions / Linting, Formatting and Type checking

Replace `·className='mr-1·text-blue-400'·style={{·fontSize:·'1.5em'·}}>&#9679;` with `⏎····················className='mr-1·text-blue-400'⏎····················style={{·fontSize:·'1.5em'·}}⏎··················>⏎····················&#9679;⏎··················`
{children}
</a>
);
Expand All @@ -543,45 +544,49 @@
return (
<a
href={`#${slug}`}
className='block cursor-pointer mb-3 text-sm leading-4 ml-3 hover:text-blue-500'
className='block cursor-pointer mb-3 font-bold text-sm leading-4 ml-[-0.40rem] font-bold hover:text-blue-500'
>
<span className='mr-1 text-blue-400' style={{ fontSize: '1.5em' }} >&#9679;</span>

Check failure on line 549 in components/StyledMarkdown.tsx

View workflow job for this annotation

GitHub Actions / Linting, Formatting and Type checking

Replace `·className='mr-1·text-blue-400'·style={{·fontSize:·'1.5em'·}}·>&#9679;` with `⏎····················className='mr-1·text-blue-400'⏎····················style={{·fontSize:·'1.5em'·}}⏎··················>⏎····················&#9679;⏎··················`
{children}
</a>
);
},
},
/* eslint-disable */
h3:
depth >= 3
? {
component: ({ children }) => {
const slug = slugifyMarkdownHeadline(children);
return (
<a
href={`#${slug}`}
className='block cursor-pointer mb-3 text-sm leading-4 ml-7 hover:text-blue-500'
>
{children}
</a>
);
},
}
component: ({ children }) => {

Check failure on line 558 in components/StyledMarkdown.tsx

View workflow job for this annotation

GitHub Actions / Linting, Formatting and Type checking

Insert `··`
const slug = slugifyMarkdownHeadline(children);

Check failure on line 559 in components/StyledMarkdown.tsx

View workflow job for this annotation

GitHub Actions / Linting, Formatting and Type checking

Insert `··`
return (

Check failure on line 560 in components/StyledMarkdown.tsx

View workflow job for this annotation

GitHub Actions / Linting, Formatting and Type checking

Replace `··················` with `····················`
<a

Check failure on line 561 in components/StyledMarkdown.tsx

View workflow job for this annotation

GitHub Actions / Linting, Formatting and Type checking

Insert `··`
href={`#${slug}`}

Check failure on line 562 in components/StyledMarkdown.tsx

View workflow job for this annotation

GitHub Actions / Linting, Formatting and Type checking

Insert `··`
className='block cursor-pointer mb-3 text-sm leading-4 ml-[-0.15rem] hover:text-blue-500'

Check failure on line 563 in components/StyledMarkdown.tsx

View workflow job for this annotation

GitHub Actions / Linting, Formatting and Type checking

Insert `··`
>
<span className='mr-1 text-blue-400'>&#8212;</span>
{children}
</a>
);
},
}
: { component: () => null },
h4:
depth >= 4
? {
component: ({ children }) => {
const slug = slugifyMarkdownHeadline(children);
return (
<a
href={`#${slug}`}
className='block cursor-pointer mb-3 text-sm leading-4 ml-10 hover:text-blue-500'
>
{children}
</a>
);
},
} /* eslint-enable */
component: ({ children }) => {
const slug = slugifyMarkdownHeadline(children);
return (
<a
href={`#${slug}`}
className='block cursor-pointer mb-3 text-sm leading-4 ml-[-0.15rem] hover:text-blue-500'
>
<span className='mr-1 text-blue-400'>&#8212;</span>
<span className='ml-[-0.25rem] mr-1 text-blue-400'>&#8212;</span>
<span className='ml-[-0.25rem] mr-1 text-blue-400'>&#8212;</span>
{children}
</a>
);
},
} /* eslint-enable */
: { component: () => null },
...hiddenElements(
'strong',
Expand Down