Skip to content

Commit cd3a711

Browse files
committed
merge: keep content before first header
This fixes the `-u` option for `apy add-from-file` and `apy update-from-file` so they don't remove content before the first header line. refer: #119
2 parents f90e5b5 + 9ed9e2c commit cd3a711

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/apyanki/anki.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,8 @@ def _update_file_with_note_ids(
597597
note_positions.append(len(content))
598598

599599
# Extract each note's section and check if it needs to be updated
600-
updated_content: list[str] = []
600+
# Keep content before first '# Note'
601+
updated_content: list[str] = content[0 : note_positions[0]]
601602
for i in range(len(note_positions) - 1):
602603
start = note_positions[i]
603604
end = note_positions[i + 1]

0 commit comments

Comments
 (0)