Skip to content

Commit

Permalink
Merging HEAD back into the branch.
Browse files Browse the repository at this point in the history
Merge commit '0f09c28c413323635a155d4a443d8551bb2218be' into do-migrations
  • Loading branch information
Oxyjun committed Jan 31, 2025
2 parents 46e363c + 0f09c28 commit 1cf14cc
Show file tree
Hide file tree
Showing 792 changed files with 12,064 additions and 7,565 deletions.
1 change: 1 addition & 0 deletions .github/styles/config/vocabularies/cloudflare/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cloudflared
Datadog
GitHub
GitLab
HashiCorp
Hono
HTTP
HTTPS
Expand Down
53 changes: 0 additions & 53 deletions .github/workflows/api-links-crawl.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/image-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
id: find-files
run: |
# Find all .png and .svg files, but only look in the ./src/assets/images directory
FILES=$(find . -type f \( -name "*.png" -o -name "*.svg" \) -path "./src/assets/images/*")
FILES=$(find . -type f \( -name "*.png" -o -name "*.svg" \) -path "./src/assets/images/*" -not -path "./src/assets/images/workers-ai/*.svg" -not -path "./src/assets/images/workers/ai/*.png" -not -path "./src/assets/images/changelog-next/*")
# Check if files are referenced in any markdown file
UNUSED_FILES=""
Expand Down
129 changes: 40 additions & 89 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@ import tailwind from "@astrojs/tailwind";
import starlightDocSearch from "@astrojs/starlight-docsearch";
import starlightImageZoom from "starlight-image-zoom";
import liveCode from "astro-live-code";
import rehypeMermaid from "rehype-mermaid";
import rehypeAutolinkHeadings, {
type Options as rehypeAutolinkHeadingsOptions,
} from "rehype-autolink-headings";
import rehypeExternalLinks from "rehype-external-links";
import starlightLinksValidator from "starlight-links-validator";
import { h } from "hastscript";
import { readdir } from "fs/promises";
import icon from "astro-icon";
import sitemap from "@astrojs/sitemap";
import react from "@astrojs/react";
import rehypeTitleFigure from "rehype-title-figure";
import rehypeHeadingSlugs from "./plugins/rehype/heading-slugs";
import { readdir } from "fs/promises";

const runLinkCheck = process.env.RUN_LINK_CHECK || false;
import rehypeTitleFigure from "rehype-title-figure";
import rehypeMermaid from "./src/plugins/rehype/mermaid.ts";
import rehypeAutolinkHeadings from "./src/plugins/rehype/autolink-headings.ts";
import rehypeExternalLinks from "./src/plugins/rehype/external-links.ts";
import rehypeHeadingSlugs from "./src/plugins/rehype/heading-slugs.ts";
import { fileURLToPath } from "url";

async function autogenSections() {
const sections = (
Expand All @@ -38,73 +35,27 @@ async function autogenSections() {
};
});
}
const AnchorLinkIcon = h(
"span",
{
ariaHidden: "true",
class: "anchor-icon",
},
h(
"svg",
{
width: 16,
height: 16,
viewBox: "0 0 24 24",
},
h("path", {
fill: "currentcolor",
d: "m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z",
}),
),
);
const autolinkConfig: rehypeAutolinkHeadingsOptions = {
properties: {
class: "anchor-link",
},
behavior: "after",
group: ({ tagName }) =>
h("div", {
tabIndex: -1,
class: `heading-wrapper level-${tagName}`,
}),
content: () => [AnchorLinkIcon],
};

const sidebar = await autogenSections();

const runLinkCheck = process.env.RUN_LINK_CHECK || false;

// https://astro.build/config
export default defineConfig({
site: "https://developers.cloudflare.com",
markdown: {
smartypants: false,
rehypePlugins: [
[
rehypeMermaid,
{
strategy: "pre-mermaid",
},
],
[
rehypeExternalLinks,
{
content: {
type: "text",
value: " ↗",
},
properties: {
target: "_blank",
},
rel: ["noopener"],
},
],
rehypeMermaid,
rehypeExternalLinks,
rehypeHeadingSlugs,
[rehypeAutolinkHeadings, autolinkConfig],
// @ts-expect-error TODO: fix types
rehypeAutolinkHeadings,
// @ts-expect-error plugins types are outdated but functional
rehypeTitleFigure,
],
},
experimental: {
contentIntellisense: true,
contentLayer: true,
directRenderScript: true,
},
server: {
port: 1111,
Expand All @@ -116,29 +67,15 @@ export default defineConfig({
src: "./src/assets/logo.svg",
},
favicon: "/favicon.png",
head: [
{
tag: "meta",
attrs: {
name: "image",
content: "https://developers.cloudflare.com/cf-twitter-card.png",
},
},
{
head: ["image", "og:image", "twitter:image"].map((name) => {
return {
tag: "meta",
attrs: {
name: "og:image",
name,
content: "https://developers.cloudflare.com/cf-twitter-card.png",
},
},
{
tag: "meta",
attrs: {
name: "twitter:image",
content: "https://developers.cloudflare.com/cf-twitter-card.png",
},
},
],
};
}),
social: {
github: "https://github.com/cloudflare/cloudflare-docs",
"x.com": "https://x.com/cloudflare",
Expand All @@ -152,27 +89,24 @@ export default defineConfig({
Footer: "./src/components/overrides/Footer.astro",
Head: "./src/components/overrides/Head.astro",
Hero: "./src/components/overrides/Hero.astro",
LastUpdated: "./src/components/overrides/LastUpdated.astro",
MarkdownContent: "./src/components/overrides/MarkdownContent.astro",
Sidebar: "./src/components/overrides/Sidebar.astro",
PageSidebar: "./src/components/overrides/PageSidebar.astro",
PageTitle: "./src/components/overrides/PageTitle.astro",
SocialIcons: "./src/components/overrides/SocialIcons.astro",
SkipLink: "./src/components/overrides/SkipLink.astro",
TableOfContents: "./src/components/overrides/TableOfContents.astro",
},
sidebar: await autogenSections(),
sidebar,
customCss: [
"./src/asides.css",
"./src/badges.css",
"./src/code.css",
"./src/footnotes.css",
"./src/headings.css",
"./src/input.css",
"./src/littlefoot.css",
"./src/mermaid.css",
"./src/table.css",
"./src/tailwind.css",
"./src/title.css",
"./src/tooltips.css",
],
pagination: false,
plugins: [
Expand Down Expand Up @@ -219,11 +153,28 @@ export default defineConfig({
}),
icon(),
sitemap({
filter(page) {
return !page.startsWith(
"https://developers.cloudflare.com/style-guide/",
);
},
serialize(item) {
item.lastmod = new Date().toISOString();
return item;
},
}),
react(),
],
vite: {
resolve: {
alias: {
"./Page.astro": fileURLToPath(
new URL("./src/components/overrides/Page.astro", import.meta.url),
),
"../components/Page.astro": fileURLToPath(
new URL("./src/components/overrides/Page.astro", import.meta.url),
),
},
},
},
});
111 changes: 0 additions & 111 deletions bin/crawl-api-links.js

This file was deleted.

Loading

0 comments on commit 1cf14cc

Please sign in to comment.