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

Fix: ToC blog page fix #721

Merged
merged 5 commits into from
May 30, 2024
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
2 changes: 1 addition & 1 deletion components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export const DocsNav = ({
</div>
{/* Reference */}

<div className='mb-2 bg-slate-200 dark:bg-slate-900 p-2 rounded border border-white shadow-lg lg:border-hidden '>
<div className='mb-2 bg-slate-200 dark:bg-slate-900 p-2 rounded border border-white lg:border-hidden '>
<div
className='flex justify-between w-full items-center'
onClick={handleClickReference}
Expand Down
48 changes: 34 additions & 14 deletions components/StyledMarkdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -540,21 +540,41 @@ export function TableOfContentMarkdown({
);
},
},
h2: {
component: ({ children }) => {
const slug = slugifyMarkdownHeadline(children);
return (
<a
href={`#${slug}`}
className='block cursor-pointer mb-3 max-sm:text-sm text-slate-600 dark:text-slate-300 leading-4 -ml-[9px] max-sm:-ml-[7px] font-medium'
>
<span className='mr-1 text-blue-400 text-[1em]'>&#9679;</span>
{children}
</a>
);
},
},

/* eslint-disable */
h2:
depth === 0
? {
component: ({ children }) => {
const slug = slugifyMarkdownHeadline(children);
return (
<a
href={`#${slug}`}
className='block cursor-pointer mb-3 text-slate-600 dark:text-slate-300 leading-4 font-medium'
>
{children}
</a>
);
},
}
: depth >= 2
? {
component: ({ children }) => {
const slug = slugifyMarkdownHeadline(children);
return (
<a
href={`#${slug}`}
className='block cursor-pointer mb-3 max-sm:text-sm text-slate-600 dark:text-slate-300 leading-4 -ml-[9px] max-sm:-ml-[7px] font-medium'
>
<span className='mr-1 text-blue-400 text-[1em]'>
&#9679;
</span>
{children}
</a>
);
},
}
: { component: () => null },
h3:
depth >= 3
? {
Expand Down
2 changes: 1 addition & 1 deletion pages/blog/posts/[slug].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default function StaticMarkdownPage({
},
)}
</div>
<div className='pt-4 pr-4 border-r border-slate-100 hidden lg:block w-full'>
<div className='pt-4 pr-4 hidden lg:block w-full'>
<div className='uppercase text-xs text-slate-400 mb-4'>
on this page
</div>
Expand Down
2 changes: 1 addition & 1 deletion pages/blog/posts/understanding-lexical-dynamic-scopes.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,6 @@ Schema](https://www.oreilly.com/library/view/unifying-business-data/978109814499
You can also connect with me on
[LinkedIn](https://www.linkedin.com/in/jviotti/).

***


*Image by [Christina Morillo](https://www.pexels.com/@divinetechygirl/) from [Pexels](https://www.pexels.com/photo/man-standing-infront-of-white-board-1181345/).*