2017-07-01 17:14:24 -07:00
|
|
|
"use strict";
|
|
|
|
|
|
2017-11-07 20:47:21 +11:00
|
|
|
// Docs: https://docusaurus.io/docs/en/site-config.html
|
|
|
|
|
|
2017-12-18 21:55:10 +11:00
|
|
|
const path = require("path");
|
|
|
|
|
const fs = require("fs");
|
2021-01-19 10:45:37 +08:00
|
|
|
const { load: parseYaml } = require("js-yaml");
|
2017-12-18 21:55:10 +11:00
|
|
|
|
2020-08-06 00:37:16 +08:00
|
|
|
const PACKAGE = require("../package.json");
|
2017-07-01 17:14:24 -07:00
|
|
|
const GITHUB_URL = `https://github.com/${PACKAGE.repository}`;
|
|
|
|
|
|
2017-12-18 21:55:10 +11:00
|
|
|
function loadYaml(fsPath) {
|
|
|
|
|
return parseYaml(fs.readFileSync(path.join(__dirname, fsPath), "utf8"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const users = loadYaml("./data/users.yml");
|
|
|
|
|
const editors = loadYaml("./data/editors.yml");
|
|
|
|
|
const supportedLanguages = loadYaml("./data/languages.yml");
|
2017-07-01 17:14:24 -07:00
|
|
|
|
|
|
|
|
const siteConfig = {
|
|
|
|
|
title: "Prettier",
|
2017-11-07 20:47:21 +11:00
|
|
|
tagline: "Opinionated Code Formatter",
|
2017-07-01 17:14:24 -07:00
|
|
|
githubUrl: GITHUB_URL,
|
|
|
|
|
url: PACKAGE.homepage,
|
|
|
|
|
baseUrl: "/",
|
|
|
|
|
projectName: PACKAGE.name,
|
|
|
|
|
repo: PACKAGE.repository,
|
2017-08-11 12:34:32 -07:00
|
|
|
cname: "prettier.io",
|
2017-07-01 17:14:24 -07:00
|
|
|
users,
|
2017-07-03 20:48:05 +10:00
|
|
|
editors,
|
|
|
|
|
supportedLanguages,
|
2019-05-13 16:21:45 -03:00
|
|
|
tideliftUrl:
|
|
|
|
|
"https://tidelift.com/subscription/pkg/npm-prettier?utm_source=npm-prettier&utm_medium=referral&utm_campaign=website",
|
2017-07-01 17:14:24 -07:00
|
|
|
/* base url for editing docs, usage example: editUrl + 'en/doc1.md' */
|
2021-01-24 01:14:13 +08:00
|
|
|
editUrl: `${GITHUB_URL}/edit/main/docs/`,
|
2017-08-11 12:34:32 -07:00
|
|
|
headerLinks: [
|
2019-05-24 18:45:04 -03:00
|
|
|
{ href: "/playground/", label: "Playground" },
|
2020-06-28 03:47:29 +02:00
|
|
|
{ doc: "index", label: "Docs" },
|
2017-12-31 15:23:17 +11:00
|
|
|
{ blog: true, label: "Blog" },
|
2017-11-07 22:03:55 +11:00
|
|
|
{ search: true },
|
2019-05-24 16:33:56 -03:00
|
|
|
{ href: "https://opencollective.com/prettier", label: "Donate" },
|
2017-08-11 12:34:32 -07:00
|
|
|
{ href: GITHUB_URL, label: "GitHub" },
|
2017-07-01 17:14:24 -07:00
|
|
|
],
|
|
|
|
|
/* path to images for header/footer */
|
|
|
|
|
headerIcon: "icon.png",
|
|
|
|
|
footerIcon: "icon.png",
|
|
|
|
|
favicon: "icon.png",
|
|
|
|
|
/* colors for website */
|
|
|
|
|
colors: {
|
|
|
|
|
primaryColor: "#1A2B34",
|
2017-11-07 20:47:21 +11:00
|
|
|
secondaryColor: "#808080",
|
2017-07-01 17:14:24 -07:00
|
|
|
},
|
2017-11-07 20:47:21 +11:00
|
|
|
highlight: {
|
|
|
|
|
theme: "default",
|
2022-05-04 10:30:25 +08:00
|
|
|
// eslint-disable-next-line import/no-extraneous-dependencies -- This is a docusaurus dependency
|
2020-03-21 22:24:23 +02:00
|
|
|
version: require("highlight.js/package.json").version,
|
2017-11-07 20:47:21 +11:00
|
|
|
},
|
2020-08-24 20:36:52 +09:00
|
|
|
usePrism: ["javascript", "jsx", "typescript", "ts", "js", "html", "css"],
|
2017-11-07 20:47:21 +11:00
|
|
|
useEnglishUrl: true,
|
2017-11-07 22:03:55 +11:00
|
|
|
scripts: ["https://buttons.github.io/buttons.js"],
|
2018-05-09 14:41:51 -03:00
|
|
|
stylesheets: [
|
|
|
|
|
"//unpkg.com/@sandhose/prettier-animated-logo@1.0.3/dist/wide.css",
|
|
|
|
|
],
|
2017-11-07 22:03:55 +11:00
|
|
|
algolia: {
|
|
|
|
|
apiKey: process.env.ALGOLIA_PRETTIER_API_KEY,
|
|
|
|
|
indexName: "prettier",
|
2017-11-27 16:32:20 +08:00
|
|
|
},
|
|
|
|
|
markdownPlugins: [
|
|
|
|
|
// ignore `<!-- prettier-ignore -->` before passing into Docusaurus to avoid mis-parsing (#3322)
|
|
|
|
|
(md) => {
|
|
|
|
|
md.block.ruler.before(
|
|
|
|
|
"htmlblock",
|
|
|
|
|
"prettierignore",
|
|
|
|
|
(state, startLine) => {
|
|
|
|
|
const pos = state.bMarks[startLine];
|
|
|
|
|
const max = state.eMarks[startLine];
|
|
|
|
|
if (/<!-- prettier-ignore -->/.test(state.src.slice(pos, max))) {
|
|
|
|
|
state.line += 1;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
},
|
2017-12-24 16:42:36 +02:00
|
|
|
],
|
2017-12-31 15:23:17 +11:00
|
|
|
separateCss: ["static/separate-css"],
|
2018-01-10 07:03:39 -05:00
|
|
|
gaTrackingId: "UA-111350464-1",
|
2018-07-01 06:59:20 -07:00
|
|
|
twitter: true,
|
2020-03-22 03:20:21 +02:00
|
|
|
twitterUsername: "PrettierCode",
|
|
|
|
|
twitterImage: "icon.png",
|
|
|
|
|
ogImage: "icon.png",
|
2018-07-01 06:59:20 -07:00
|
|
|
onPageNav: "separate",
|
2017-07-01 17:14:24 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = siteConfig;
|