From 395b5da7659cc6acdddf11d2bd23a736c1b90850 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Mon, 20 Sep 2021 14:30:20 +0200 Subject: [PATCH] Anchor improvements to the documentation --- CHANGELOG.md | 2 +- docs/components/Docs/Markdown.tsx | 15 ++++++++++++--- docs/components/Docs/Page.tsx | 6 ++++-- docs/components/Docs/PageInfo.tsx | 2 +- docs/content/changelog/CHANGELOG.md | 2 +- docs/content/changelog/v4_0_0.md | 6 ++++-- docs/pages/updates/[slug].tsx | 10 +++++++--- docs/styles/globals.css | 7 +++++++ 8 files changed, 37 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac9280ad..b9070983 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## [4.0.0] - (upcoming release) +## [4.0.0] - (upcoming release) - [Release Notes](https://beta.frontmatter.codes/updates/v4_0_0) - [#101](https://github.com/estruyf/vscode-front-matter/issues/101): Date picker available on the metadata section - [#102](https://github.com/estruyf/vscode-front-matter/issues/102): Support comma separated arrays in front matter diff --git a/docs/components/Docs/Markdown.tsx b/docs/components/Docs/Markdown.tsx index e66593df..4f056fa7 100644 --- a/docs/components/Docs/Markdown.tsx +++ b/docs/components/Docs/Markdown.tsx @@ -1,3 +1,4 @@ +import { LinkIcon } from '@heroicons/react/outline'; import Link from 'next/link'; import * as React from 'react'; import { useEffect } from 'react'; @@ -20,6 +21,14 @@ export const Markdown: React.FunctionComponent = ({content}: Rea return title.toLowerCase().replace(/\s/g, '-'); }; + const generateLink = (props: any) => { + return ( + + ); + }; + useEffect(() => { const elms = document.querySelectorAll('blockquote > p > strong'); for (let i = 0; i < elms.length; i++) { @@ -48,9 +57,9 @@ export const Markdown: React.FunctionComponent = ({content}: Rea } return {title}; }, - h1: ({node, ...props}) => (

{getTitle(props)}

), - h2: ({node, ...props}) => (

{getTitle(props)}

), - h3: ({node, ...props}) => (

{getTitle(props)}

), + h1: ({node, ...props}) => (

{getTitle(props)}{generateLink(props)}

), + h2: ({node, ...props}) => (

{getTitle(props)}{generateLink(props)}

), + h3: ({node, ...props}) => (

{getTitle(props)}{generateLink(props)}

), }} rehypePlugins={[rehypeRaw]} children={content} /> diff --git a/docs/components/Docs/Page.tsx b/docs/components/Docs/Page.tsx index 1450cef9..658e2ab5 100644 --- a/docs/components/Docs/Page.tsx +++ b/docs/components/Docs/Page.tsx @@ -9,13 +9,15 @@ export interface IPageProps { } export const Page: React.FunctionComponent = ({items, page, children}: React.PropsWithChildren) => { + + return (
- +
{children} diff --git a/docs/components/Docs/PageInfo.tsx b/docs/components/Docs/PageInfo.tsx index 189889e2..ac5b9cad 100644 --- a/docs/components/Docs/PageInfo.tsx +++ b/docs/components/Docs/PageInfo.tsx @@ -20,7 +20,7 @@ export const PageInfo: React.FunctionComponent = ({page}: React. { date && (
- Last updated on{` `}{format(date, `MMM dd, yyyy`)} + Last updated on{` `}
) } diff --git a/docs/content/changelog/CHANGELOG.md b/docs/content/changelog/CHANGELOG.md index ac9280ad..b9070983 100644 --- a/docs/content/changelog/CHANGELOG.md +++ b/docs/content/changelog/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## [4.0.0] - (upcoming release) +## [4.0.0] - (upcoming release) - [Release Notes](https://beta.frontmatter.codes/updates/v4_0_0) - [#101](https://github.com/estruyf/vscode-front-matter/issues/101): Date picker available on the metadata section - [#102](https://github.com/estruyf/vscode-front-matter/issues/102): Support comma separated arrays in front matter diff --git a/docs/content/changelog/v4_0_0.md b/docs/content/changelog/v4_0_0.md index feb445fa..a10cf5a2 100644 --- a/docs/content/changelog/v4_0_0.md +++ b/docs/content/changelog/v4_0_0.md @@ -1,6 +1,8 @@ --- title: Version 4.0.0 release notes -description: In this new major release of Front Matter, we got some great new features to announce to you. +description: 'In this new major release of Front Matter, we got some great new features to announce to you.' +date: '2021-09-20T11:51:43.926Z' +lastmod: '2021-09-20T11:51:45.273Z' --- ## Team level settings @@ -52,4 +54,4 @@ In the content type, we support the following field types currently: - [#106](https://github.com/estruyf/vscode-front-matter/issues/106): Introduction of team level settings for Front Matter - [#107](https://github.com/estruyf/vscode-front-matter/issues/107): Number field support added in content type fields - [#108](https://github.com/estruyf/vscode-front-matter/issues/108): Choice field support added in content type fields -- [#109](https://github.com/estruyf/vscode-front-matter/issues/109): JSON Config script added to automate the JSON schema \ No newline at end of file +- [#109](https://github.com/estruyf/vscode-front-matter/issues/109): JSON Config script added to automate the JSON schema diff --git a/docs/pages/updates/[slug].tsx b/docs/pages/updates/[slug].tsx index 64b89424..e5787e15 100644 --- a/docs/pages/updates/[slug].tsx +++ b/docs/pages/updates/[slug].tsx @@ -1,11 +1,13 @@ +import { format, parseJSON } from 'date-fns'; import React from 'react'; import { Markdown } from '../../components/Docs/Markdown'; import { Description, OtherMeta, Title } from '../../components/Meta'; import { Layout } from '../../components/Page/Layout'; import { getAllPosts, getPostByFilename } from '../../lib/api'; -export default function Home({ title, content, description }: any) { - +export default function Home({ title, content, description, date }: any) { + const pubDate = date ? parseJSON(date) : ''; + return ( <> @@ -18,6 +20,8 @@ export default function Home({ title, content, description }: any) { <h1 className="text-5xl tracking-tight font-extrabold sm:leading-none lg:text-5xl xl:text-6xl">{title}</h1> <p className="mt-3 text-base text-whisper-700 sm:mt-5 sm:text-xl lg:text-lg xl:text-xl">{description}</p> + + { pubDate && <p className="mt-3 text-whisper-900">Published: <time dateTime={format(pubDate, 'yyyy-MM-dd')}>{format(pubDate, 'MMM dd, yyyy')}</time></p> } </div> <div className={`changelog`}> @@ -30,7 +34,7 @@ export default function Home({ title, content, description }: any) { } export const getStaticProps = async ({ params }: any) => { - const changes = getPostByFilename('changelog', `${params.slug}.md`, ['title', 'content', 'description']); + const changes = getPostByFilename('changelog', `${params.slug}.md`, ['title', 'content', 'description', 'date']); return { props: { ...changes } diff --git a/docs/styles/globals.css b/docs/styles/globals.css index ad5a83e1..4c07d218 100644 --- a/docs/styles/globals.css +++ b/docs/styles/globals.css @@ -6,6 +6,13 @@ html, body {height: 100%;} +.header__offset:before { + content: ""; + display: block; + height: 100px; + margin: -100px 0 0; +} + .changelog { @apply py-8 space-y-4;