Skip to content

Commit ef6d940

Browse files
committed
agrega: comentarios al archivo generarListaDeApuntes.js
1 parent 15eaf86 commit ef6d940

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

generarListaDeApuntes.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ fs.readdir(RELATIVE_PATH_OF_NOTES_FOLDER, (err, listOfNoteFiles) => {
3636

3737
let noteYear = noteContentPerLine[1].split('_').at(-1)
3838

39+
// We only use the title and RELATIVE_PATH attributes, but we may use the rest in the future
3940
const note = {
4041
title: noteTitle,
4142
formattedDate,
@@ -48,13 +49,15 @@ fs.readdir(RELATIVE_PATH_OF_NOTES_FOLDER, (err, listOfNoteFiles) => {
4849

4950
notes.push(`- [${note.title}](${note.RELATIVE_PATH.split(' ').join('%20')})`)
5051

52+
// Checks if all the notes are in notes array
5153
const isThisTheLastNote = (listOfNoteFiles.length - 1) === index;
5254
if (isThisTheLastNote) {
53-
// Now the whole notes are in notes array
55+
// Modify the README.md file to include the list of notes
5456
fs.readFile('README.md', 'utf-8', (err, readmeContent) => {
5557
if (err) {
5658
return console.error('Error al leer apunte (note) ', err);
5759
}
60+
5861
const readmeContentWithoutNoteList = readmeContent.split('<!--lista_apuntes-->')[0]
5962
const content = `${readmeContentWithoutNoteList}<!--lista_apuntes-->\n## Lista de apuntes\n${notes.join('\n')}\n<!--lista_apuntes-->`
6063
fs.writeFile('README.md', content, (err) => {

0 commit comments

Comments
 (0)