mirror of https://github.com/cncf/techdocs.git
Rename {analyses,docs}/**/README.md to index.md (#323)
This commit is contained in:
parent
c91a1e0028
commit
97a0fffdfd
|
|
@ -4,3 +4,4 @@
|
|||
list-marker-space: false
|
||||
no-inline-html: false
|
||||
no-bare-urls: false
|
||||
single-h1: false # Temporary
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: Docs assessment
|
||||
cSpell:ignore: Horgan celestehorgan hashlinks
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: Notary Project Docs Assessment
|
||||
cSpell:ignore: docset notaryproject celestehorgan
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: Krator Docs assessment
|
||||
cSpell:ignore: Krator celestehorgan CODEOWNERS
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: 'Assessment: Project Tremor'
|
||||
cSpell:ignore: Horgan onramps offramps LLDB Wayfair
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: Assessment template
|
||||
cSpell:ignore: celestehorgan Horgan
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: 'Assessment: Project Kubernetes Gateway API'
|
||||
cSpell:ignore: Meha Bhalodiya mehabhalodiya kubernetes
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: Porter Docs Analysis
|
||||
cSpell:ignore: Uchechukwu Obasi
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: Backstage Glossary
|
||||
---
|
||||
|
||||
# Backstage Glossary
|
||||
|
||||
## API
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: Backstage Insights
|
||||
cSpell:ignore: flipside
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: Backstage umbrella issue
|
||||
---
|
||||
|
||||
# Backstage umbrella issue
|
||||
|
||||
## Overview
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: Backstage User Roles for Doc
|
||||
---
|
||||
|
||||
# Backstage User Roles for Doc
|
||||
|
||||
This document provides recommendations for user roles, or personas, for
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: Analysis of Existing Documentation
|
||||
---
|
||||
|
||||
# Analysis of Existing Documentation
|
||||
|
||||
This document characterizes the effectiveness and completeness of the in-toto
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: Documentation Issues
|
||||
---
|
||||
|
||||
# Documentation Issues
|
||||
|
||||
These issues identify and classify tasks that contributors can undertake to
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: Implementation
|
||||
cSpell:ignore: roadmaps Cappos
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: README
|
||||
---
|
||||
|
||||
# README
|
||||
|
||||
These documents are intended to recommend a direction for the ongoing
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: Survey of existing documentation as of 09/2023
|
||||
---
|
||||
|
||||
# Survey of existing documentation as of 09/2023
|
||||
|
||||
The following links are loosely sorted into conceptual categories.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: TUF Documentation Analysis
|
||||
cSpell:ignore: theupdateframework
|
||||
---
|
||||
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: TechDocs Analysis for CNCF Projects
|
||||
---
|
||||
|
||||
<!-- cSpell:ignore projectname -->
|
||||
|
||||
# TechDocs Analysis for CNCF Projects
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: Assessment criteria and examples
|
||||
---
|
||||
|
||||
# Assessment criteria and examples
|
||||
|
||||
We recommend reading the
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: CNCF TechDocs Analysis How-To
|
||||
---
|
||||
|
||||
# CNCF TechDocs Analysis How-To
|
||||
|
||||
## Audience
|
||||
|
|
@ -217,5 +221,5 @@ Create issues in the project documentation GitHub repository for:
|
|||
[analyses]: ../../analyses/
|
||||
[criteria]: ./criteria.md
|
||||
[project maturity level]: https://www.cncf.io/project-metrics
|
||||
[templates]: ./templates/README.md
|
||||
[templates]: ./templates/index.md
|
||||
[issues list]: ./templates/issues-list.md
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: TechDoc Analysis
|
||||
---
|
||||
|
||||
# TechDoc Analysis
|
||||
|
||||
This section contains instructions and criteria for completing a documentation
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: TechDoc Analysis Templates
|
||||
---
|
||||
|
||||
# TechDoc Analysis Templates
|
||||
|
||||
This section contains templates for analyzing a CNCF project's documentation.
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: Analytics
|
||||
---
|
||||
|
||||
# Analytics
|
||||
|
||||
## Google Analytics
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: Migrating Universal to Google Analytics 4
|
||||
cSpell:ignore: gtag kubernetes
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: Assistance program for technical documentation
|
||||
---
|
||||
|
||||
# Assistance program for technical documentation
|
||||
|
||||
This document outlines the Cloud Native Computing Foundation (CNCF) Technical
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: Hugo and Docsy
|
||||
---
|
||||
|
||||
# Hugo and Docsy
|
||||
|
||||
Tips:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
---
|
||||
title: CNCF Techdocs how-tos
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# CNCF Techdocs how-tos
|
||||
|
||||
This directory contains documentation on how the CNCF TechDocs team does things.
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: CNCF Localization Guides
|
||||
---
|
||||
|
||||
# CNCF Localization Guides
|
||||
|
||||
This directory contains a growing collection of localization guides that CNCF
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: CNCF日本語ローカライゼーション向けガイドライン
|
||||
---
|
||||
|
||||
# CNCF日本語ローカライゼーション向けガイドライン
|
||||
|
||||
このドキュメントでは、CNCFのプロジェクトをローカライズする際に参考になる一般的なガイドラインを提供します。
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: Netlify and domain setup
|
||||
cSpell:ignore: caniszczyk
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: Repository setup
|
||||
cSpell:ignore: cncf
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: CNCF sandbox project documentation primer
|
||||
---
|
||||
|
||||
# CNCF sandbox project documentation primer
|
||||
|
||||
This document is a quick primer for CNCF project maintainers and contributors
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: Documentation Search
|
||||
---
|
||||
|
||||
# Documentation Search
|
||||
|
||||
<!-- markdownlint-disable no-duplicate-heading -->
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: Services for projects
|
||||
---
|
||||
|
||||
# Services for projects
|
||||
|
||||
The CNCF provides technical writing and documentation website services for all
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: prettier-ignore
|
||||
# prettier-ignore
|
||||
cSpell:ignore: Batard Brubaker Pursley velero fullversion githubbranch docsbranch Tanzu Rosland Horgan Takahashi
|
||||
---
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
title: CNCF website guidelines checklist
|
||||
---
|
||||
|
||||
# CNCF website guidelines checklist
|
||||
|
||||
As per the
|
||||
|
|
|
|||
|
|
@ -0,0 +1,100 @@
|
|||
import { readFile, writeFile } from 'fs/promises';
|
||||
import { glob } from 'glob';
|
||||
import path from 'path';
|
||||
|
||||
// Regular expression to match frontmatter
|
||||
const frontmatterRegex = /^---\s*\n([\s\S]*?)\n---\s*\n/;
|
||||
|
||||
// Regular expression to match first heading
|
||||
const headingRegex = /^#\s+(.+)$/m;
|
||||
|
||||
// Regular expression to match title in frontmatter
|
||||
const titleRegex = /^title:\s*(.+)$/m;
|
||||
|
||||
async function processFile(filePath) {
|
||||
try {
|
||||
const content = await readFile(filePath, 'utf-8');
|
||||
const headingMatch = content.match(headingRegex);
|
||||
|
||||
if (!headingMatch) {
|
||||
console.log(`Warning: ${filePath} has no heading to use as title`);
|
||||
return;
|
||||
}
|
||||
|
||||
const headingTitle = headingMatch[1].trim();
|
||||
let hasFrontmatter = false;
|
||||
let existingTitle = null;
|
||||
let contentWithoutFrontmatter = content;
|
||||
let existingFrontmatter = '';
|
||||
|
||||
// Check for existing frontmatter
|
||||
const frontmatterMatch = content.match(frontmatterRegex);
|
||||
if (frontmatterMatch) {
|
||||
hasFrontmatter = true;
|
||||
existingFrontmatter = frontmatterMatch[1];
|
||||
contentWithoutFrontmatter = content.slice(frontmatterMatch[0].length);
|
||||
|
||||
// Check if title already exists
|
||||
const titleMatch = existingFrontmatter.match(titleRegex);
|
||||
if (titleMatch) {
|
||||
existingTitle = titleMatch[1].trim();
|
||||
}
|
||||
}
|
||||
|
||||
// Only update if:
|
||||
// 1. No frontmatter exists, or
|
||||
// 2. Frontmatter exists but has no title, or
|
||||
// 3. Frontmatter title doesn't match the heading
|
||||
const needsUpdate = !hasFrontmatter || !existingTitle;
|
||||
// || existingTitle !== headingTitle
|
||||
if (needsUpdate) {
|
||||
let newFrontmatter;
|
||||
const formattedTitle = headingTitle.includes(':')
|
||||
? `'${headingTitle}'`
|
||||
: headingTitle;
|
||||
if (hasFrontmatter) {
|
||||
// Remove existing title if it exists
|
||||
const frontmatterWithoutTitle = existingFrontmatter
|
||||
.replace(titleRegex, '')
|
||||
.trim();
|
||||
newFrontmatter = `title: ${formattedTitle}${frontmatterWithoutTitle ? '\n' + frontmatterWithoutTitle : ''}`;
|
||||
} else {
|
||||
newFrontmatter = `title: ${formattedTitle}`;
|
||||
}
|
||||
|
||||
const newContent = `---
|
||||
${newFrontmatter}
|
||||
---\n
|
||||
${contentWithoutFrontmatter}`;
|
||||
|
||||
await writeFile(filePath, newContent);
|
||||
console.log(
|
||||
`${hasFrontmatter ? 'Updated' : 'Added'} frontmatter to ${filePath}`,
|
||||
);
|
||||
} else {
|
||||
console.log(`Skipping ${filePath} - frontmatter title matches heading`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error processing ${filePath}:`, error);
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
// Find all markdown files in docs directory
|
||||
const files = await glob('{analyses,docs}/**/*.md');
|
||||
console.log(`Found ${files.length} markdown files`);
|
||||
|
||||
// Process each file
|
||||
for (const file of files) {
|
||||
await processFile(file);
|
||||
}
|
||||
|
||||
console.log('Done!');
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
Loading…
Reference in New Issue