feat: Sort and format daily notes list
This commit is contained in:
parent
ace2a98954
commit
cfc11495e6
11
main.py
11
main.py
|
@ -15,8 +15,15 @@ def collect_daily_notes():
|
|||
try:
|
||||
all_files = os.listdir(daily_notes_path)
|
||||
md_files = [f for f in all_files if os.path.isfile(os.path.join(daily_notes_path, f)) and f.endswith('.md')]
|
||||
logging.debug(f"Found .md files: {md_files}")
|
||||
return md_files
|
||||
|
||||
# Sort in reverse alphabetical order
|
||||
md_files.sort(reverse=True)
|
||||
|
||||
# Transform to the desired format
|
||||
formatted_notes = [f"![[{f[:-3]}]]" for f in md_files]
|
||||
|
||||
logging.debug(f"Formatted notes: {formatted_notes}")
|
||||
return formatted_notes
|
||||
except OSError as e:
|
||||
logging.error(f"Error accessing directory {daily_notes_path}: {e}")
|
||||
return []
|
||||
|
|
Loading…
Reference in New Issue
Block a user