siteConfig.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. "use strict";
  2. // Docs: https://docusaurus.io/docs/en/site-config.html
  3. const parseYaml = require("js-yaml").safeLoad;
  4. const path = require("path");
  5. const fs = require("fs");
  6. const PACKAGE = require("../package");
  7. const GITHUB_URL = `https://github.com/${PACKAGE.repository}`;
  8. function loadYaml(fsPath) {
  9. return parseYaml(fs.readFileSync(path.join(__dirname, fsPath), "utf8"));
  10. }
  11. const users = loadYaml("./data/users.yml");
  12. const editors = loadYaml("./data/editors.yml");
  13. const supportedLanguages = loadYaml("./data/languages.yml");
  14. const siteConfig = {
  15. title: "Prettier",
  16. tagline: "Opinionated Code Formatter",
  17. githubUrl: GITHUB_URL,
  18. url: PACKAGE.homepage,
  19. baseUrl: "/",
  20. projectName: PACKAGE.name,
  21. repo: PACKAGE.repository,
  22. cname: "prettier.io",
  23. users,
  24. editors,
  25. supportedLanguages,
  26. /* base url for editing docs, usage example: editUrl + 'en/doc1.md' */
  27. editUrl: `${GITHUB_URL}/edit/master/docs/`,
  28. headerLinks: [
  29. { href: "/playground/", label: "Playground" },
  30. { doc: "index", label: "About" },
  31. { doc: "install", label: "Usage" },
  32. { blog: true, label: "Blog" },
  33. { search: true },
  34. { href: GITHUB_URL, label: "GitHub" }
  35. ],
  36. /* path to images for header/footer */
  37. headerIcon: "icon.png",
  38. footerIcon: "icon.png",
  39. favicon: "icon.png",
  40. /* colors for website */
  41. colors: {
  42. primaryColor: "#1A2B34",
  43. secondaryColor: "#808080"
  44. },
  45. highlight: {
  46. theme: "default"
  47. },
  48. useEnglishUrl: true,
  49. scripts: ["https://buttons.github.io/buttons.js"],
  50. stylesheets: [
  51. "//unpkg.com/@sandhose/prettier-animated-logo@1.0.3/dist/wide.css"
  52. ],
  53. algolia: {
  54. apiKey: process.env.ALGOLIA_PRETTIER_API_KEY,
  55. indexName: "prettier"
  56. },
  57. markdownPlugins: [
  58. // ignore `<!-- prettier-ignore -->` before passing into Docusaurus to avoid mis-parsing (#3322)
  59. md => {
  60. md.block.ruler.before(
  61. "htmlblock",
  62. "prettierignore",
  63. (state, startLine) => {
  64. const pos = state.bMarks[startLine];
  65. const max = state.eMarks[startLine];
  66. if (/<!-- prettier-ignore -->/.test(state.src.slice(pos, max))) {
  67. state.line += 1;
  68. return true;
  69. }
  70. return false;
  71. }
  72. );
  73. }
  74. ],
  75. separateCss: ["static/separate-css"],
  76. gaTrackingId: "UA-111350464-1",
  77. twitter: true
  78. };
  79. module.exports = siteConfig;