Skip to content

Commit

Permalink
add reference in TOC
Browse files Browse the repository at this point in the history
  • Loading branch information
techmannih committed Dec 15, 2024
1 parent 54c355a commit 40ce79a
Show file tree
Hide file tree
Showing 19 changed files with 201 additions and 175 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"js-yaml": "^4.1.0",
"jsonpath": "^1.1.1",
"jszip": "^3.10.1",
"markdown-to-jsx": "^7.6.2",
"markdown-to-jsx": "^7.7.1",
"moment": "2.30.1",
"next": "14.2.14",
"next-sitemap": "^4.2.3",
Expand Down
13 changes: 6 additions & 7 deletions pages/[slug].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import getStaticMarkdownProps from '~/lib/getStaticMarkdownProps';
import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import { DocsHelp } from '~/components/DocsHelp';
import { TableOfContentMarkdown } from '~/components/StyledMarkdown';
import { TableOfContentMarkdown } from '~/components/StyledMarkdown';

export async function getStaticPaths() {
return getStaticMarkdownPaths('pages');
Expand All @@ -27,19 +27,18 @@ export default function StaticMarkdownPage({
const newTitle = 'JSON Schema - ' + frontmatter.title;
return (
<SectionContext.Provider value={frontmatter.section || null}>

<div className="flex pt-4">
<div className="w-full pr-5">
<div className='flex pt-4'>
<div className='w-full pr-5'>
<Head>
<title>{newTitle}</title>
</Head>
<Headline1>{frontmatter.title}</Headline1>
<StyledMarkdown markdown={content} />
<DocsHelp markdownFile={markdownFile} />
</div>
<div className="w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden">
<div className="h-full overflow-y-auto scrollbar-hidden pl-5">
<div className="uppercase text-xs text-slate-400 mb-4">
<div className='w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden'>
<div className='h-full overflow-y-auto scrollbar-hidden pl-5'>
<div className='uppercase text-xs text-slate-400 mb-4'>
On this page
</div>
<TableOfContentMarkdown markdown={content} depth={3} />
Expand Down
21 changes: 10 additions & 11 deletions pages/draft-05/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ import DocTable from '~/components/DocTable';
import { Headline1 } from '~/components/Headlines';
import { DocsHelp } from '~/components/DocsHelp';
import { TableOfContentMarkdown } from '~/components/StyledMarkdown';

export async function getStaticProps() {
const index = fs.readFileSync('pages/draft-05/index.md', 'utf-8');
const main = fs.readFileSync('pages/draft-05/release-notes.md', 'utf-8');
const index = fs.readFileSync('pages/draft/2020-12/index.md', 'utf-8');
const { content: indexContent, data: indexData } = matter(index);
const { content: bodyContent } = matter(main);

const frontmatter = { ...indexData };
return {
props: {
blocks: {
index: indexContent,
body: bodyContent,
},
frontmatter,
},
Expand All @@ -35,23 +33,24 @@ export default function ImplementationsPages({
}) {
return (
<SectionContext.Provider value={null}>
<div className="flex pt-4">
<div className="w-full pr-5">
<div className='flex pt-4'>
<div className='w-full pr-5'>
<Headline1>{frontmatter.title}</Headline1>
<DocTable frontmatter={frontmatter} />
<StyledMarkdown markdown={blocks.index} />
<StyledMarkdown markdown={blocks.body} />
<DocsHelp />
</div>
<div className="w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden">
<div className="h-full overflow-y-auto scrollbar-hidden pl-5">
<div className="uppercase text-xs text-slate-400 mb-4">On this page</div>
<div className='w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden'>
<div className='h-full overflow-y-auto scrollbar-hidden pl-5'>
<div className='uppercase text-xs text-slate-400 mb-4'>
On this page
</div>
<TableOfContentMarkdown markdown={blocks.index} depth={3} />
<TableOfContentMarkdown markdown={blocks.body} depth={3} />
</div>
</div>
</div>
</SectionContext.Provider>
);
}

ImplementationsPages.getLayout = getLayout;
31 changes: 18 additions & 13 deletions pages/draft-06/[slug].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import { DocsHelp } from '~/components/DocsHelp';
import { TableOfContentMarkdown } from '~/components/StyledMarkdown';

export async function getStaticPaths() {
return getStaticMarkdownPaths('pages/draft-06');
}

export async function getStaticProps(args: any) {
return getStaticMarkdownProps(args, 'pages/draft-06');
}
Expand All @@ -23,27 +25,30 @@ export default function StaticMarkdownPage({
content: any;
}) {
const markdownFile = '_index';
const newTitle = 'JSON Schema - ' + frontmatter.title;
const newTitle = `JSON Schema - ${frontmatter.title}`;

return (
<SectionContext.Provider value={frontmatter.section || null}>
<div className="flex pt-4">
<div className="w-full pr-5">
<Head>
<title>{newTitle}</title>
</Head>
<Headline1>{frontmatter.title}</Headline1>
<StyledMarkdown markdown={content} />
<DocsHelp markdownFile={markdownFile} />
</div>
<div className="w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden">
<div className="h-full overflow-y-auto scrollbar-hidden pl-5">
<div className="uppercase text-xs text-slate-400 mb-4">On this page</div>
<div className='flex pt-4'>
<div className='w-full pr-5'>
<Head>
<title>{newTitle}</title>
</Head>
<Headline1>{frontmatter.title}</Headline1>
<StyledMarkdown markdown={content} />
<DocsHelp markdownFile={markdownFile} />
</div>
<div className='w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden'>
<div className='h-full overflow-y-auto scrollbar-hidden pl-5'>
<div className='uppercase text-xs text-slate-400 mb-4'>
On this page
</div>
<TableOfContentMarkdown markdown={content} depth={3} />
</div>
</div>
</div>
</SectionContext.Provider>
);
}

StaticMarkdownPage.getLayout = getLayout;
22 changes: 12 additions & 10 deletions pages/draft-06/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,18 @@ export default function ImplementationsPages({
}) {
return (
<SectionContext.Provider value={null}>
<div className="flex pt-4">
<div className="w-full pr-5">
<Headline1>{frontmatter.title}</Headline1>
<DocTable frontmatter={frontmatter} />
<StyledMarkdown markdown={blocks.index} />
<DocsHelp />
</div>
<div className="w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden">
<div className="h-full overflow-y-auto scrollbar-hidden pl-5">
<div className="uppercase text-xs text-slate-400 mb-4">On this page</div>
<div className='flex pt-4'>
<div className='w-full pr-5'>
<Headline1>{frontmatter.title}</Headline1>
<DocTable frontmatter={frontmatter} />
<StyledMarkdown markdown={blocks.index} />
<DocsHelp />
</div>
<div className='w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden'>
<div className='h-full overflow-y-auto scrollbar-hidden pl-5'>
<div className='uppercase text-xs text-slate-400 mb-4'>
On this page
</div>
<TableOfContentMarkdown markdown={blocks.index} depth={3} />
</div>
</div>
Expand Down
26 changes: 14 additions & 12 deletions pages/draft-07/[slug].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@ export default function StaticMarkdownPage({

return (
<SectionContext.Provider value={frontmatter.section || null}>
<div className="flex pt-4">
<div className="w-full pr-5">
<Head>
<title>{newTitle}</title>
</Head>
<Headline1>{frontmatter.title}</Headline1>
<StyledMarkdown markdown={content} />
<DocsHelp markdownFile={markdownFile} />
</div>
<div className="w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden">
<div className="h-full overflow-y-auto scrollbar-hidden pl-5">
<div className="uppercase text-xs text-slate-400 mb-4">On this page</div>
<div className='flex pt-4'>
<div className='w-full pr-5'>
<Head>
<title>{newTitle}</title>
</Head>
<Headline1>{frontmatter.title}</Headline1>
<StyledMarkdown markdown={content} />
<DocsHelp markdownFile={markdownFile} />
</div>
<div className='w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden'>
<div className='h-full overflow-y-auto scrollbar-hidden pl-5'>
<div className='uppercase text-xs text-slate-400 mb-4'>
On this page
</div>
<TableOfContentMarkdown markdown={content} depth={3} />
</div>
</div>
Expand Down
24 changes: 13 additions & 11 deletions pages/draft-07/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SectionContext } from '~/context';
import DocTable from '~/components/DocTable';
import { Headline1 } from '~/components/Headlines';
import { DocsHelp } from '~/components/DocsHelp';
import { TableOfContentMarkdown } from '~/components/StyledMarkdown';
import { TableOfContentMarkdown } from '~/components/StyledMarkdown';
export async function getStaticProps() {
const index = fs.readFileSync('pages/draft-07/index.md', 'utf-8');

Expand All @@ -33,16 +33,18 @@ export default function ImplementationsPages({
}) {
return (
<SectionContext.Provider value={null}>
<div className="flex pt-4">
<div className="w-full pr-5">
<Headline1>{frontmatter.title}</Headline1>
<DocTable frontmatter={frontmatter} />
<StyledMarkdown markdown={blocks.index} />
<DocsHelp />
</div>
<div className="w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden">
<div className="h-full overflow-y-auto scrollbar-hidden pl-5">
<div className="uppercase text-xs text-slate-400 mb-4">On this page</div>
<div className='flex pt-4'>
<div className='w-full pr-5'>
<Headline1>{frontmatter.title}</Headline1>
<DocTable frontmatter={frontmatter} />
<StyledMarkdown markdown={blocks.index} />
<DocsHelp />
</div>
<div className='w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden'>
<div className='h-full overflow-y-auto scrollbar-hidden pl-5'>
<div className='uppercase text-xs text-slate-400 mb-4'>
On this page
</div>
<TableOfContentMarkdown markdown={blocks.index} depth={3} />
</div>
</div>
Expand Down
24 changes: 14 additions & 10 deletions pages/draft/2019-09/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import DocTable from '~/components/DocTable';
import { Headline1 } from '~/components/Headlines';
import { DocsHelp } from '~/components/DocsHelp';
import { TableOfContentMarkdown } from '~/components/StyledMarkdown';

export async function getStaticProps() {
const index = fs.readFileSync('pages/draft/2019-09/index.md', 'utf-8');
const { content: indexContent, data: indexData } = matter(index);
Expand All @@ -32,21 +33,24 @@ export default function ImplementationsPages({
}) {
return (
<SectionContext.Provider value={null}>
<div className="flex pt-4">
<div className="w-full pr-5">
<Headline1>{frontmatter.title}</Headline1>
<DocTable frontmatter={frontmatter} />
<StyledMarkdown markdown={blocks.index} />
<DocsHelp />
</div>
<div className="w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden">
<div className="h-full overflow-y-auto scrollbar-hidden pl-5">
<div className="uppercase text-xs text-slate-400 mb-4">On this page</div>
<div className='flex pt-4'>
<div className='w-full pr-5'>
<Headline1>{frontmatter.title}</Headline1>
<DocTable frontmatter={frontmatter} />
<StyledMarkdown markdown={blocks.index} />
<DocsHelp />
</div>
<div className='w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden'>
<div className='h-full overflow-y-auto scrollbar-hidden pl-5'>
<div className='uppercase text-xs text-slate-400 mb-4'>
On this page
</div>
<TableOfContentMarkdown markdown={blocks.index} depth={3} />
</div>
</div>
</div>
</SectionContext.Provider>
);
}

ImplementationsPages.getLayout = getLayout;
68 changes: 37 additions & 31 deletions pages/draft/2020-12/[slug].page.tsx
Original file line number Diff line number Diff line change
@@ -1,50 +1,56 @@
import React from 'react';
import Head from 'next/head';
import { getLayout } from '~/components/Sidebar';
import fs from 'fs';
import matter from 'gray-matter';
import StyledMarkdown from '~/components/StyledMarkdown';
import getStaticMarkdownPaths from '~/lib/getStaticMarkdownPaths';
import getStaticMarkdownProps from '~/lib/getStaticMarkdownProps';
import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import DocTable from '~/components/DocTable';
import { Headline1 } from '~/components/Headlines';
import { DocsHelp } from '~/components/DocsHelp';
import { TableOfContentMarkdown } from '~/components/StyledMarkdown';
export async function getStaticPaths() {
return getStaticMarkdownPaths('pages/draft/2020-12');
}
export async function getStaticProps(args: any) {
return getStaticMarkdownProps(args, 'pages/draft/2020-12');

export async function getStaticProps() {
const index = fs.readFileSync('pages/draft/2019-09/index.md', 'utf-8');
const { content: indexContent, data: indexData } = matter(index);

const frontmatter = { ...indexData };
return {
props: {
blocks: {
index: indexContent,
},
frontmatter,
},
};
}

export default function StaticMarkdownPage({
export default function ImplementationsPages({
blocks,
frontmatter,
content,
}: {
blocks: any;
frontmatter: any;
content: any;
}) {
const markdownFile = '_index';
const newTitle = 'JSON Schema - ' + frontmatter.title;

return (
<SectionContext.Provider value={frontmatter.section || null}>
<div className="flex pt-4">
<div className="w-full pr-5">
<Head>
<title>{newTitle}</title>
</Head>
<Headline1>{frontmatter.title}</Headline1>
<StyledMarkdown markdown={content} />
<DocsHelp markdownFile={markdownFile} />
</div>
<div className="w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden">
<div className="h-full overflow-y-auto scrollbar-hidden pl-5">
<div className="uppercase text-xs text-slate-400 mb-4">On this page</div>
<TableOfContentMarkdown markdown={content} depth={3} />
<SectionContext.Provider value={null}>
<div className='flex pt-4'>
<div className='w-full pr-5'>
<Headline1>{frontmatter.title}</Headline1>
<DocTable frontmatter={frontmatter} />
<StyledMarkdown markdown={blocks.index} />
<DocsHelp />
</div>
<div className='w-2/5 lg:block mt-10 hidden sticky top-24 h-[calc(100vh-6rem)] overflow-hidden'>
<div className='h-full overflow-y-auto scrollbar-hidden pl-5'>
<div className='uppercase text-xs text-slate-400 mb-4'>
On this page
</div>
<TableOfContentMarkdown markdown={blocks.index} depth={3} />
</div>
</div>
</div>
</SectionContext.Provider>

);
}
StaticMarkdownPage.getLayout = getLayout;

ImplementationsPages.getLayout = getLayout;
Loading

0 comments on commit 40ce79a

Please sign in to comment.