1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-08-15 05:34:05 +02:00

Add types to links

This commit is contained in:
Kamran Ahmed
2024-06-06 23:23:55 +01:00
parent 0a579b4507
commit 390db65e32
2455 changed files with 6127 additions and 6116 deletions

View File

@@ -129,19 +129,20 @@ allRoadmapDirs.forEach((roadmapId) => {
// for each of the files, assign the type of link to the beginning of each markdown link
// i.e. - [@article@abc](xyz) where @article@ is the type of link. Possible types:
// - @official@
// - @opensource@
// - @article@
// - @course@
// - @opensource@
// - @podcast@
// - @video@
// - @website@
files.forEach((file) => {
const content = fs.readFileSync(file, 'utf-8');
const lines = content.split('\n');
const newContent = lines
.map((line) => {
if (line.startsWith('- [')) {
if (line.startsWith('- [') && !line.startsWith('- [@')) {
const type = line.match(/@(\w+)@/);
if (type) {
return line;
@@ -158,8 +159,8 @@ allRoadmapDirs.forEach((roadmapId) => {
}
if (!fullUrl) {
console.error('No URL found in line:', line);
return;
console.error('Invalid URL found in:', file);
return line;
}
}