Skip to content

Commit 55d07e0

Browse files
committed
Merge branch 'main' of github.com:FrontMatter/web-documentation-nextjs
2 parents bff51ea + 5ad7958 commit 55d07e0

File tree

12 files changed

+91
-55
lines changed

12 files changed

+91
-55
lines changed

components/Docs/PageInfo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ export const PageInfo: React.FunctionComponent<IPageInfoProps> = ({ page, items
4646
{(prevPage && prevPage.slug && prevPage.title) && (
4747
<a href={`/docs/${(prevPage as PageFrontMatter).slug}`}
4848
title={prevPage.title}
49-
className={`border border-vulcan-100 hover:border-teal-900 rounded-sm w-1/2 p-4 items-start flex flex-col gap-2 text-teal-500 hover:text-teal-900`}>
49+
className={`border border-vulcan-100 hover:border-teal-900 rounded w-1/2 p-4 items-start flex flex-col gap-2 text-teal-500 hover:text-teal-900`}>
5050
<span className="text-base text-whisper-500">Previous</span>
5151
<span>&larr; {(prevPage as PageFrontMatter).title}</span>
5252
</a>
5353
)}
5454
{(nextPage && nextPage.slug && nextPage.title) && (
5555
<a href={`/docs/${(nextPage as PageFrontMatter).slug}`}
5656
title={nextPage.title}
57-
className={`border border-vulcan-100 hover:border-teal-900 rounded-sm w-1/2 p-4 items-end ml-auto flex flex-col gap-2 text-teal-500 hover:text-teal-900`}>
57+
className={`border border-vulcan-100 hover:border-teal-900 rounded w-1/2 p-4 items-end ml-auto flex flex-col gap-2 text-teal-500 hover:text-teal-900`}>
5858
<span className="text-base text-whisper-500">Next</span>
5959
<span>{(nextPage as PageFrontMatter).title} &rarr;</span>
6060
</a>

components/GitHub/Stargazers.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { Extension } from '../../constants/extension';
55
import { StarService } from '../../services/StarService';
66
import { GitHub } from '../Images/GitHub';
77

8-
export interface IStargazersProps {}
8+
export interface IStargazersProps { }
99

1010
export const Stargazers: React.FunctionComponent<IStargazersProps> = (props: React.PropsWithChildren<IStargazersProps>) => {
11-
const [ stars, setStars ] = useState<number | null>(null);
12-
const [ calling, setCalling ] = useState<boolean>(false);
11+
const [stars, setStars] = useState<number | null>(null);
12+
const [calling, setCalling] = useState<boolean>(false);
1313

1414
useEffect(() => {
1515
const getStars = async () => {
@@ -23,10 +23,10 @@ export const Stargazers: React.FunctionComponent<IStargazersProps> = (props: Rea
2323
}, [calling]);
2424

2525
return (
26-
<div className={`stargazers group flex items-center`} style={{height:"36px"}}>
27-
<Link
26+
<div className={`stargazers group flex items-center`} style={{ height: "36px" }}>
27+
<Link
2828
href={Extension.githubLink}
29-
className={`h-full flex items-center bg-whisper-500 text-vulcan-500 p-2 text-xs font-bold group-hover:bg-whisper-700`}
29+
className={`h-full flex items-center bg-whisper-500 text-vulcan-500 p-2 text-xs font-bold group-hover:bg-whisper-700 rounded`}
3030
title={`Give the project a star on GitHub`}>
3131
<GitHub className={`h-4 w-4 mr-1`} />
3232
<span>Star</span>
@@ -41,7 +41,7 @@ export const Stargazers: React.FunctionComponent<IStargazersProps> = (props: Rea
4141

4242
<Link
4343
href={Extension.stars}
44-
className={`h-full flex items-center bg-whisper-500 text-vulcan-500 p-2 text-xs font-bold group-hover:bg-whisper-700`}
44+
className={`h-full flex items-center bg-whisper-500 text-vulcan-500 p-2 text-xs font-bold group-hover:bg-whisper-700 rounded`}
4545
title={`Give the project a star on GitHub`}>
4646
{stars}
4747
</Link>

components/Page/CTA.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Extension } from '../../constants/extension';
44
import { isProduction } from '../../helpers/isProduction';
55
import { FrontMatterLines } from './FrontMatterLines';
66

7-
export interface ICTAProps {}
7+
export interface ICTAProps { }
88

99
export const CTA: React.FunctionComponent<ICTAProps> = (props: React.PropsWithChildren<ICTAProps>) => {
1010
const { t: strings } = useTranslation();
@@ -33,10 +33,10 @@ export const CTA: React.FunctionComponent<ICTAProps> = (props: React.PropsWithCh
3333

3434
<div className="mt-10 max-w-sm mx-auto sm:max-w-none">
3535
<div className="space-y-4 sm:space-y-0 sm:mx-auto sm:inline-grid sm:grid-cols-2 sm:gap-5">
36-
<a href={`/docs/getting-started`} title={`Read our documentation`} className="flex items-center justify-center px-4 py-3 border border-transparent text-base font-medium shadow-sm text-white bg-teal-500 hover:bg-opacity-70 sm:px-8">
36+
<a href={`/docs/getting-started`} title={`Read our documentation`} className="flex items-center justify-center px-4 py-3 border border-transparent rounded text-base font-medium shadow-sm text-white bg-teal-500 hover:bg-opacity-70 sm:px-8">
3737
{strings(`cta_button_primary`) as string}
3838
</a>
39-
<a href={isProduction() ? Extension.installLink : Extension.installBetaLink} className="flex items-center justify-center px-4 py-3 border border-transparent text-base font-medium shadow-sm text-vulcan-500 bg-whisper-500 hover:bg-opacity-70 sm:px-8">
39+
<a href={isProduction() ? Extension.installLink : Extension.installBetaLink} className="flex items-center justify-center px-4 py-3 border border-transparent rounded text-base font-medium shadow-sm text-vulcan-500 bg-whisper-500 hover:bg-opacity-70 sm:px-8">
4040
{isProduction() ? strings(`cta_button_secondary`) as string : strings(`cta_button_beta_secondary`) as string}
4141
</a>
4242
</div>
@@ -47,8 +47,8 @@ export const CTA: React.FunctionComponent<ICTAProps> = (props: React.PropsWithCh
4747
<div className="sm:mx-auto sm:max-w-3xl sm:px-6">
4848
<div className={`py-12 sm:relative sm:py-16 lg:absolute lg:inset-y-0 lg:right-0 lg:w-1/2`}>
4949
<div className={`relative sm:mx-auto sm:max-w-3xl sm:px-0 lg:-mr-40 lg:max-w-none lg:h-full lg:pl-12`}>
50-
<img
51-
className={`w-full lg:h-full lg:w-auto lg:max-w-none`}
50+
<img
51+
className={`w-full lg:h-full lg:w-auto lg:max-w-none`}
5252
// src={`https://res.cloudinary.com/estruyf/image/upload/w_1256/v1631871148/frontmatter/preview-3.2.0.png`}
5353
// src={"https://res.cloudinary.com/estruyf/image/upload/w_1256/v1649328023/frontmatter/7.1.0/panel-preview-light.png"}
5454
src={"https://res.cloudinary.com/estruyf/image/upload/w_1256/v1649335002/frontmatter/7.1.0/fm-doc-screenshot.png"}

components/Page/Features.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const Features: React.FunctionComponent<IFeaturesProps> = (props: React.P
4444
<div className="mt-4">
4545
<Link
4646
href={Extension.featureLink}
47-
className={`inline-block px-4 py-3 border border-transparent text-base font-medium shadow-sm text-white bg-vulcan-50 hover:bg-opacity-70 sm:px-8`}
47+
className={`inline-block px-4 py-3 border border-transparent rounded text-base font-medium shadow-sm text-white bg-vulcan-50 hover:bg-opacity-70 sm:px-8`}
4848
target={`_blank`}
4949
rel={`noopener noreferrer`}>
5050
{strings(`features_cta_button`) as string}

components/Page/GetStarted.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ export const GetStarted: React.FunctionComponent<IGetStartedProps> = (props: Rea
1515
<span className="block">Ready to get started?</span>
1616
</h2>
1717
<div className="mt-6 lg:mt-auto space-y-4 sm:space-y-0 sm:flex sm:space-x-5">
18-
<a href={isProduction() ? Extension.installLink : Extension.installBetaLink} title={`Read our documentation`} className="flex items-center justify-center px-4 py-3 border border-transparent text-base font-medium shadow-sm text-white bg-teal-500 hover:bg-opacity-70 sm:px-8">
18+
<a href={isProduction() ? Extension.installLink : Extension.installBetaLink} title={`Read our documentation`} className="flex items-center justify-center px-4 py-3 border border-transparent rounded text-base font-medium shadow-sm text-white bg-teal-500 hover:bg-opacity-70 sm:px-8">
1919
{strings(`cta_button_bottom_primary`) as string}
2020
</a>
21-
<a href={`/docs/getting-started`} className="flex items-center justify-center px-4 py-3 border border-transparent text-base font-medium shadow-sm text-vulcan-500 bg-whisper-500 hover:bg-opacity-70 sm:px-8">
21+
<a href={`/docs/getting-started`} className="flex items-center justify-center px-4 py-3 border border-transparent rounded text-base font-medium shadow-sm text-vulcan-500 bg-whisper-500 hover:bg-opacity-70 sm:px-8">
2222
{strings(`cta_button_bottom_secondary`) as string}
2323
</a>
2424
</div>

components/Page/Hero.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const Hero: React.FunctionComponent<IHeroProps> = ({ view, title, descrip
3636
<Link
3737
href={link}
3838
title={linkText}
39-
className={`inline-block px-4 py-3 border border-transparent text-base font-medium shadow-sm text-white bg-teal-500 hover:bg-opacity-70 sm:px-8`}>
39+
className={`inline-block px-4 py-3 border border-transparent text-base font-medium rounded shadow-sm text-white bg-teal-500 hover:bg-opacity-70 sm:px-8`}>
4040
{linkText}
4141
</Link>
4242
)

components/Pricing/Pricing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const Pricing: React.FunctionComponent<IPricingProps> = (props: React.Pro
2121

2222
<navigation.sponsor.icon
2323
title={strings(`pricing_cta_title`)}
24-
btnClassName={`group mt-4 inline-block px-4 py-3 border border-transparent text-base font-medium shadow-sm text-white bg-vulcan-50 hover:bg-vulcan-500 sm:px-8`}
24+
btnClassName={`group mt-4 inline-block px-4 py-3 border border-transparent rounded text-base font-medium shadow-sm text-white bg-vulcan-50 hover:bg-vulcan-500 sm:px-8`}
2525
className="inline-block h-6 w-6"
2626
aria-hidden="true" />
2727
</div>

components/modal/Modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const Modal: React.FunctionComponent<React.PropsWithChildren<IModalProps>
3737
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
3838
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
3939
>
40-
<div className="inline-block align-bottom bg-vulcan-200 px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full sm:p-6">
40+
<div className="inline-block align-bottom bg-vulcan-200 px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full sm:p-6 rounded">
4141
{children}
4242
</div>
4343
</Transition.Child>

constants/navigation.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const navigation = {
4040
open && (
4141
<Modal isOpen={open} onClose={() => setOpen(false)}>
4242
<div className="relative">
43-
<div className="hidden sm:block absolute top-0 right-0 pr-4">
43+
<div className="hidden sm:block absolute top-0 right-0">
4444
<button
4545
type="button"
4646
className="bg-vulcan-50 rounded-md text-whisper-900 hover:text-whisper-300 focus:outline-none"
@@ -67,7 +67,7 @@ export const navigation = {
6767
</div>
6868
<div className="mt-5 sm:mt-6 space-y-4">
6969
<a
70-
className="inline-flex justify-center w-full px-4 py-2 bg-whisper-600 text-base font-medium text-vulcan-500 hover:bg-rose-900 hover:text-whisper-500 focus:outline-none sm:text-sm"
70+
className="inline-flex justify-center w-full px-4 py-2 bg-whisper-600 text-base font-medium text-vulcan-500 hover:bg-rose-900 hover:text-whisper-500 focus:outline-none sm:text-sm rounded"
7171
onClick={() => setOpen(false)}
7272
href={Extension.sponsorLink}
7373
target={`_blank`}
@@ -76,7 +76,7 @@ export const navigation = {
7676
GitHub Sponsor
7777
</a>
7878
<a
79-
className="inline-flex justify-center w-full px-4 py-2 bg-whisper-600 text-base font-medium text-vulcan-500 hover:bg-rose-900 hover:text-whisper-500 focus:outline-none sm:text-sm"
79+
className="inline-flex justify-center w-full px-4 py-2 bg-whisper-600 text-base font-medium text-vulcan-500 hover:bg-rose-900 hover:text-whisper-500 focus:outline-none sm:text-sm rounded"
8080
onClick={() => setOpen(false)}
8181
href={Extension.sponsorOpenCollective}
8282
target={`_blank`}
@@ -85,7 +85,7 @@ export const navigation = {
8585
Open Collective
8686
</a>
8787
<a
88-
className="inline-flex justify-center w-full px-4 py-2 bg-whisper-600 text-base font-medium text-vulcan-500 hover:bg-rose-900 hover:text-whisper-500 focus:outline-none sm:text-sm"
88+
className="inline-flex justify-center w-full px-4 py-2 bg-whisper-600 text-base font-medium text-vulcan-500 hover:bg-rose-900 hover:text-whisper-500 focus:outline-none sm:text-sm rounded"
8989
onClick={() => setOpen(false)}
9090
href={Extension.sponsorCoffee}
9191
target={`_blank`}

content/docs/content-creation/placeholders.md

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Placeholders
33
slug: content-creation/placeholders
44
description: null
55
date: 2022-03-14T08:42:21.626Z
6-
lastmod: 2023-08-20T11:04:12.770Z
6+
lastmod: 2024-01-31T16:17:03.272Z
77
weight: 200.4
88
---
99

@@ -140,26 +140,30 @@ Here is an example of a dynamic `uniqueId` placeholder:
140140
"frontMatter.content.placeholders": [
141141
{
142142
"id": "uniqueId",
143-
"script": "./scripts/uniqueId.js",
144-
"command": "~/.nvm/versions/node/v16.13.1/bin/node"
143+
"script": "./scripts/uniqueId.mjs",
144+
"command": "~/.nvm/versions/node/v18.17.1/bin/node"
145145
}
146146
]
147147
```
148148

149149
#### Placeholder script
150150

151-
The base script looks like this:
151+
To get started, you first need to install the
152+
[@frontmatter/extensibility](https://www.npmjs.com/package/@frontmatter/extensibility)
153+
dependency.
154+
155+
```bash
156+
npm i @frontmatter/extensibility
157+
```
158+
159+
Once installed, you can use the following example:
152160

153161
```javascript
154-
const arguments = process.argv;
162+
import { PlaceholderScript } from "@frontmatter/extensibility";
155163

156-
if (arguments && arguments.length > 0) {
157-
const workspaceArg = arguments[2]; // The workspace path
158-
const filePath = arguments[3]; // The path of the file
159-
const title = arguments[4]; // Title of the page
164+
const { workspacePath, filePath, title, answers } = PlaceholderScript.getArguments();
160165

161-
console.log(Math.random().toString(36).substring(2, 15));
162-
}
166+
PlaceholderScript.done(Math.random().toString(36).substring(2, 15));
163167
```
164168

165169
> **Info**: Like the other content scripts, you can use other types of scripts like Python, Bash,
@@ -172,6 +176,38 @@ that the file is still not completely processed, and not all front matter fields
172176
> **Important**: In case you need to retrieve the whole front matter object, you can make use of the
173177
> `postScript` property on your content type in combination with a [content script][01].
174178
179+
You can also ask additional input/questions during the placeholder script execution.
180+
For instance, if you want to pick between a category upon content creation, you can use the
181+
`PlaceholderScript.askQuestions` method.
182+
183+
```javascript
184+
import { PlaceholderScript } from "@frontmatter/extensibility";
185+
186+
(async () => {
187+
const { answers } =
188+
PlaceholderScript.getArguments();
189+
190+
if (!answers) {
191+
PlaceholderScript.askQuestions([
192+
{
193+
name: "category",
194+
message: "What category do you want to use for this article?"
195+
},
196+
]);
197+
return;
198+
}
199+
200+
const { category } = answers;
201+
202+
if (!category) {
203+
PlaceholderScript.done(undefined);
204+
return;
205+
}
206+
207+
PlaceholderScript.done(category);
208+
})();
209+
```
210+
175211
#### Placeholder usage
176212

177213
To use the `ogImage` placeholder, you need to define the `{{ogImage}}` value in your field as

0 commit comments

Comments
 (0)