Skip to content

Commit

Permalink
apply nitpicks 3
Browse files Browse the repository at this point in the history
  • Loading branch information
vishvamsinh28 committed Dec 14, 2024
1 parent c951b91 commit 8ffb9b9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scripts/build-post-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ const addItem = (details) => {
result["about"].push(details)
};

/**
* Builds a list of posts from the specified directories and writes it to a file
* @param {Array<Array<string>>} postDirectories - Array of [directory, slug] tuples
* @param {string} basePath - Base path for resolving relative paths
* @param {string} writeFilePath - Path where the output JSON will be written
* @throws {Error} If required parameters are missing or if any operation fails
* @returns {Promise<void>}
*/
async function buildPostList(postDirectories, basePath, writeFilePath) {
try {

Expand Down Expand Up @@ -144,6 +152,11 @@ async function walkDirectories(directories, resultObj, basePath, sectionTitle, s
}
}

/**
* Extracts heading IDs from markdown headings
* @param {string} str - The heading text containing potential ID
* @returns {string} The extracted ID or empty string if no valid ID found
*/
function slugifyToC(str) {
if (typeof str !== 'string') return '';
let slug = '';
Expand Down

0 comments on commit 8ffb9b9

Please sign in to comment.