diff --git a/JavaScript/chatbot-nextjs/README.md b/JavaScript/chatbot-nextjs/README.md index 46a2fcb1..dd475959 100644 --- a/JavaScript/chatbot-nextjs/README.md +++ b/JavaScript/chatbot-nextjs/README.md @@ -4,13 +4,19 @@

+ 📚 Documentation - | +   + • +   + 🖥️ Application - | +   + • +   + 🏠 Home

-

:bangbang: Make sure you've read the getting started section in the main README. diff --git a/JavaScript/langchain/README.md b/JavaScript/langchain/README.md index a73b1c25..99c27337 100644 --- a/JavaScript/langchain/README.md +++ b/JavaScript/langchain/README.md @@ -4,13 +4,19 @@

+ 📚 Documentation - | +   + • +   + 🖥️ Application - | +   + • +   + 🏠 Home

-

:bangbang: Make sure you've read the getting started section in the main README. diff --git a/JavaScript/novel-ai-text-editor/README.md b/JavaScript/novel-ai-text-editor/README.md index 1db023e1..32ceaed5 100644 --- a/JavaScript/novel-ai-text-editor/README.md +++ b/JavaScript/novel-ai-text-editor/README.md @@ -4,13 +4,19 @@

+ 📚 Documentation - | +   + • +   + 🖥️ Application - | +   + • +   + 🏠 Home

-

:bangbang: Make sure you've read the getting started section in the main README. diff --git a/JavaScript/openai-automated/README.md b/JavaScript/openai-automated/README.md index 62e846f4..b5a5ff2e 100644 --- a/JavaScript/openai-automated/README.md +++ b/JavaScript/openai-automated/README.md @@ -4,13 +4,19 @@

+ 📚 Documentation - | +   + • +   + 🖥️ Application - | +   + • +   + 🏠 Home

-

:bangbang: Make sure you've read the getting started section in the main README. diff --git a/JavaScript/openai-manual/README.md b/JavaScript/openai-manual/README.md index 43d33a27..646908b4 100644 --- a/JavaScript/openai-manual/README.md +++ b/JavaScript/openai-manual/README.md @@ -4,13 +4,19 @@

+ 📚 Documentation - | +   + • +   + 🖥️ Application - | +   + • +   + 🏠 Home

-

:bangbang: Make sure you've read the getting started section in the main README. diff --git a/Python/langchain/README.md b/Python/langchain/README.md index 8f5f1816..6d55d2b2 100644 --- a/Python/langchain/README.md +++ b/Python/langchain/README.md @@ -4,13 +4,19 @@

+ 📚 Documentation - | +   + • +   + 🖥️ Application - | +   + • +   + 🏠 Home

-

:bangbang: Make sure you've read the getting started section in the main README. diff --git a/Python/openai-manual/README.md b/Python/openai-manual/README.md index d08f79cd..8805c1c4 100644 --- a/Python/openai-manual/README.md +++ b/Python/openai-manual/README.md @@ -4,13 +4,19 @@

+ 📚 Documentation - | +   + • +   + 🖥️ Application - | +   + • +   + 🏠 Home

-

:bangbang: Make sure you've read the getting started section in the main README. diff --git a/README.md b/README.md index 987a64cd..1a9615f7 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,29 @@ +

+ 📚 Documentation - | +   + • +   + 🖥️ Application - | +   + • +   + 🏠 Home

+ + +

+ + + +

This repository contains examples of how to use Autoblocks with various frameworks, libraries, and languages. diff --git a/tools/make-toc.js b/tools/make-toc.js index b22e7cd0..bd2fc391 100644 --- a/tools/make-toc.js +++ b/tools/make-toc.js @@ -11,24 +11,41 @@ const makeMarkdownTable = (headers, rows) => { }).join('\n'); }; -// Text we add to the top of each individual README +const replaceContentBetweenComments = ({ content, startComment, endComment, replacement }) => { + const startIdx = content.indexOf(startComment) + startComment.length; + const endIdx = content.indexOf(endComment); + return `${content.slice(0, startIdx)}\n${replacement}\n${content.slice(endIdx)}`; +}; + +// Banner we add to the top of each README const BANNER = `

+ 📚 Documentation - | +   + • +   + 🖥️ Application - | +   + • +   + 🏠 Home -

+

`; -

+// Reminder we add below the banner to each individual project README +const GETTING_STARTED_REMINDER = `

:bangbang: Make sure you've read the getting started section in the main README.

`; +const BANNER_START_COMMENT = ''; +const BANNER_END_COMMENT = ''; + (async function () { let readme = await fs.readFile('README.md', 'utf-8'); @@ -54,34 +71,37 @@ const BANNER = `

// Add name and description to table rows.push([`[${project}](/${section}/${project})`, description]); - // Add banner to top of README let projectReadme = await fs.readFile(`${section}/${project}/README.md`, 'utf-8'); - - // Find start and end of banner in project README - const startComment = ''; - const endComment = ''; - const startIdx = projectReadme.indexOf(startComment) + startComment.length; - const endIdx = projectReadme.indexOf(endComment); - - // Replace the content between the comments with the banner - projectReadme = `${projectReadme.slice(0, startIdx)}\n${BANNER}\n${projectReadme.slice(endIdx)}`; + // Add banner + getting started reminder to top of project README + projectReadme = replaceContentBetweenComments({ + content: projectReadme, + startComment: BANNER_START_COMMENT, + endComment: BANNER_END_COMMENT, + replacement: [BANNER, GETTING_STARTED_REMINDER].join('\n'), + }); + // Write the new project README await fs.writeFile(`${section}/${project}/README.md`, projectReadme); } - const table = makeMarkdownTable(headers, rows); - - // Look for comments that looks like "" and "" - const startComment = ``; - const endComment = ``; - const startIdx = readme.indexOf(startComment) + startComment.length; - const endIdx = readme.indexOf(endComment); - - // Replace the content between the comments with the table in the README - readme = `${readme.slice(0, startIdx)}\n${table}\n${readme.slice(endIdx)}`; + // Add the table of projects to the main README + readme = replaceContentBetweenComments({ + content: readme, + startComment: ``, + endComment: ``, + replacement: makeMarkdownTable(headers, rows), + }); } + // Add banner to main README + readme = replaceContentBetweenComments({ + content: readme, + startComment: BANNER_START_COMMENT, + endComment: BANNER_END_COMMENT, + replacement: BANNER, + }); + // Write the new README await fs.writeFile('README.md', readme); })();