Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .htmltest.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# cSpell:ignore github
CacheExpires: 9000h # ~ 12 months
DirectoryPath: build
DirectoryPath: dist
TestFilesConcurrently: true
IgnoreCanonicalBrokenLinks: true
IgnoreEmptyHref: true
IgnoreAltEmpty: true
IgnoreDirs:
- analyses
IgnoreInternalURLs: # list of paths
IgnoreURLs: # list of regexes of URLs or path to be ignored
- ^https?://localhost
- \?no-link-check
- \?(_PROJECT|TODO)
# FIXME: temporary ignore rules
- assistance\.md
- LICENSE
Expand Down
47 changes: 47 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// @ts-check
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import { visit } from 'unist-util-visit';
import { rewriteMdLinks } from './src/plugins/rewrite-md-links.mjs';

// https://astro.build/config
export default defineConfig({
// site: 'https://astro--cncf-techdocs.netlify.app/',
integrations: [
starlight({
title: 'CNCF Techdocs',
// favicon: 'static/img/cncf-icon-color.svg', // cSpell:disable-line
customCss: ['./src/css/custom.css'],
sidebar: [
{
label: 'Docs',
collapsed: true,
autogenerate: {
directory: 'docs',
},
},
{
label: 'Project Analyses',
collapsed: true,
autogenerate: {
directory: 'analyses',
},
},
],
social: [
{
icon: 'github',
label: 'GitHub',
href: 'https://github.com/withastro/starlight',
},
],
}),
],
// Configure Astro's markdown handling
markdown: {
// Enable smartypants and other markdown features
// smartypants: true,
// Configure remark plugins
remarkPlugins: [rewriteMdLinks],
},
});
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build]
publish = "build"
publish = "dist"
command = "npm run build:preview"

[context.production]
Expand Down
22 changes: 18 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"name": "techdocs",
"version": "0.0.0",
"description": "Resources provided by the CNCF Technical Documentation team.",
"type": "module",
"scripts": {
"_build": "npm run docus:build",
"_build": "npm run astro:build -- --force",
"_check:format:any": "npx prettier --check --ignore-path ''",
"_check:format:delta": "npm run _check:format:any -- $(npm run -s _list:git:delta)",
"_check:format": "npx prettier --check .",
Expand All @@ -18,6 +19,12 @@
"_list:check:md": "find . -name '*.md' -not -path '*/node_modules/*' -a -not -path '*/.?*' | grep -Eve '/000|/0010'",
"_list:fix:*": "npm run --loglevel=warn | grep -Ee '^\\s*fix:[^:]+$' | grep -v 'fix:all'",
"_list:git:delta": "git diff --name-only --diff-filter=ACMR | grep -E '\\.(js|md|scss|yml|yaml)$'",
"add-frontmatter": "node scripts/add-frontmatter.mjs",
"astro:build": "astro build",
"astro:postbuild": "find dist -name \"*.html\" -exec perl -i -pe 's|<link rel=\"canonical\"\\s*/>||g' {} +",
"astro:dev": "astro dev",
"astro:preview": "astro preview",
"astro": "astro",
"build:preview": "npm run _build",
"build:production": "npm run _build",
"build": "BUILD_ENV=dev npm run _build",
Expand All @@ -26,6 +33,7 @@
"check:markdown": "npm run _check:markdown:all",
"check:spelling": "npx cspell --no-progress -c .cspell.yml analyses docs *.md",
"check": "npm run seq -- $(npm run -s _list:check:*)",
"postastro:build": "find dist -name \"*.html\" -exec perl -i -pe 's|<link rel=\"canonical\"\\s*/>||g' {} +",
"docus:build": "docusaurus build",
"docus:clear": "docusaurus clear",
"docus:deploy": "docusaurus deploy",
Expand All @@ -47,28 +55,34 @@
"author": "CNCF",
"license": "CC-BY-4.0",
"dependencies": {
"@astrojs/starlight": "^0.34.4",
"@docusaurus/core": "3.8.1",
"@docusaurus/preset-classic": "3.8.1",
"@mdx-js/react": "^3.1.0",
"astro": "^5.6.1",
"clsx": "^2.1.1",
"prism-react-renderer": "^2.4.1",
"react-dom": "^19.1.0",
"react": "^19.1.0"
"react": "^19.1.0",
"sharp": "^0.32.5",
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.8.1",
"@docusaurus/tsconfig": "3.8.1",
"@docusaurus/types": "3.8.1",
"cspell": "^9.1.1",
"glob": "^10.3.10",
"markdown-link-check": "3.13.7",
"markdownlint-cli": "^0.45.0",
"markdownlint": "^0.38.0",
"npm-check-updates": "^18.0.1",
"prettier": "^3.5.3",
"typescript": "~5.8.3"
"typescript": "~5.8.3",
"yaml": "^2.4.0"
},
"private": true,
"spelling": "cSpell:ignore ACMR docus HTMLTEST loglevel pkgs -",
"spelling": "cSpell:ignore ACMR docus frontmatter HTMLTEST loglevel pkgs postbuild -",
"prettier": {
"proseWrap": "always",
"singleQuote": true
Expand Down
1 change: 1 addition & 0 deletions public/favicon.svg
7 changes: 7 additions & 0 deletions src/content.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineCollection } from 'astro:content';
import { docsLoader } from '@astrojs/starlight/loaders';
import { docsSchema } from '@astrojs/starlight/schema';

export const collections = {
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
};
1 change: 1 addition & 0 deletions src/content/docs/analyses
1 change: 1 addition & 0 deletions src/content/docs/docs
20 changes: 20 additions & 0 deletions src/content/docs/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Welcome
# description:
template: splash
hero:
tagline: Techdocs how-tos & project analyses
image:
file: ../../../static/img/cncf-icon-color.svg
actions:
- text: Docs
link: /docs/
# icon: right-arrow
- text: Project analyses
link: /analyses/
variant: secondary
---

import README from '../../../README.md';

<README />
4 changes: 4 additions & 0 deletions src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@
--ifm-color-primary-lightest: #4fddbf;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
}

.sl-heading-wrapper.level-h1 {
display: none;
}
3 changes: 0 additions & 3 deletions src/pages/index.mdx

This file was deleted.

46 changes: 46 additions & 0 deletions src/plugins/rewrite-md-links.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { visit } from 'unist-util-visit';

/**
* A remark plugin that rewrites markdown links from GitHub-style `.md`
* references to relative paths without the `.md` extension, handling index
* files appropriately.
*/
export function rewriteMdLinks() {
return (tree, file) => {
// console.log('rewriteMdLinks: Processing file:', file.path);

// Check if this is an index.md file
const isIndexFile =
file.basename === 'index.md' || file.basename === 'README.md';

// Helper function to process .md links
const processMdLink = (node) => {
if (typeof node.url === 'string' && /\.md($|[\/#])/.test(node.url)) {
// if (node.url.startsWith('docs/assistance')) {
// console.log('rewriteMdLinks: Found .md link:', node.url, 'in file:', file.path);
// }

if (node.url.startsWith('http')) return;

// Remove .md extension
let url = node.url.replace(/(?:index)?\.md($|[\/#])/, '/$1');

// If it's a sibling file (no / or starts with ./), handle based on file type
if (true || /^([^\/]|\.\/)/.test(node.url)) {
if (url.startsWith('./')) url = url.slice(2);
if (!isIndexFile) {
url = '../' + url;
}
}
node.url = url;
//console.log('rewriteMdLinks: Rewrote link to:', node.url);
}
};

// Handle inline markdown links
visit(tree, 'link', processMdLink);

// Handle link definitions (reference-style links)
visit(tree, 'definition', processMdLink);
};
}
4 changes: 4 additions & 0 deletions static/refcache.json
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,10 @@
"StatusCode": 206,
"LastSeen": "2025-03-19T11:52:41.206262-04:00"
},
"https://github.com/withastro/starlight": {
"StatusCode": 206,
"LastSeen": "2025-06-18T06:17:48.988777-04:00"
},
"https://goharbor.io/": {
"StatusCode": 206,
"LastSeen": "2025-03-19T11:52:42.657248-04:00"
Expand Down
9 changes: 3 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
// This file is not used in compilation. It is here just for a nice editor experience.
"extends": "@docusaurus/tsconfig",
"compilerOptions": {
"baseUrl": "."
},
"exclude": [".docusaurus", "build"]
"extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"]
}