File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,14 +66,17 @@ def validate_tags(tags, filename=None) -> list[str]:
6666 filename: Optional filename for better error messages
6767
6868 Returns:
69- List of normalized (lowercase) tags
69+ List of normalized (lowercase) tags with duplicates removed.
70+ Original order is preserved.
7071
7172 Raises:
7273 ValueError: If tags are invalid (wrong type, empty list, contain whitespace, etc.)
7374
7475 Note:
75- An empty tags list (tags: []) is considered invalid. If you have no tags,
76- omit the 'tags' field entirely from the frontmatter.
76+ - An empty tags list (tags: []) is considered invalid. If you have no tags,
77+ omit the 'tags' field entirely from the frontmatter.
78+ - Duplicate tags (after normalization) are automatically removed while
79+ preserving the order of first occurrence.
7780 """
7881 context = f" in { filename } " if filename else ""
7982
@@ -96,7 +99,7 @@ def validate_tags(tags, filename=None) -> list[str]:
9699
97100 normalized .append (tag .lower ())
98101
99- return list (set (normalized ))
102+ return list (dict . fromkeys (normalized ))
100103
101104
102105def get_version_from_pyproject () -> str :
You can’t perform that action at this time.
0 commit comments