Merge pull request #312 from ggozad/feat/support-puml

Support for plantuml diagrams
This commit is contained in:
Yiorgis Gozadinos 2026-03-16 11:09:48 +02:00 committed by GitHub
commit 705950e345
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 31 additions and 0 deletions

View file

@ -1,6 +1,10 @@
# Changelog
## [Unreleased]
### Added
- **PlantUML support**: `.puml`, `.plantuml`, and `.pu` files are now indexed as `plantuml` code blocks
## [0.34.0] - 2026-03-13
### Added

View file

@ -109,6 +109,7 @@ The file monitor processes documents using [Docling](https://github.com/DS4SD/do
- Python (`.py`)
- JavaScript (`.js`)
- TypeScript (`.ts`)
- PlantUML (`.puml`, `.plantuml`, `.pu`)
- And other text-based code files
**Plain text:**

View file

@ -54,8 +54,11 @@ class TextFileHandler:
".nix",
".php",
".pl",
".plantuml",
".pm",
".proto",
".pu",
".puml",
".ps1",
".py",
".r",
@ -118,8 +121,11 @@ class TextFileHandler:
".nix": "nix",
".php": "php",
".pl": "perl",
".plantuml": "plantuml",
".pm": "perl",
".proto": "protobuf",
".pu": "plantuml",
".puml": "plantuml",
".ps1": "powershell",
".py": "python",
".r": "r",

View file

@ -89,12 +89,24 @@ class TestTextFileHandler:
assert ".js" in TextFileHandler.text_extensions
assert ".txt" in TextFileHandler.text_extensions
def test_plantuml_extensions_supported(self):
"""Test that PlantUML extensions are in text_extensions."""
assert ".puml" in TextFileHandler.text_extensions
assert ".plantuml" in TextFileHandler.text_extensions
assert ".pu" in TextFileHandler.text_extensions
def test_code_markdown_identifiers(self):
"""Test code language identifiers mapping."""
assert TextFileHandler.code_markdown_identifier[".py"] == "python"
assert TextFileHandler.code_markdown_identifier[".js"] == "javascript"
assert TextFileHandler.code_markdown_identifier[".ts"] == "typescript"
def test_plantuml_markdown_identifiers(self):
"""Test PlantUML language identifiers mapping."""
assert TextFileHandler.code_markdown_identifier[".puml"] == "plantuml"
assert TextFileHandler.code_markdown_identifier[".plantuml"] == "plantuml"
assert TextFileHandler.code_markdown_identifier[".pu"] == "plantuml"
def test_prepare_text_content_with_code(self):
"""Test that code files are wrapped in markdown code blocks."""
code = "def hello():\n pass"
@ -103,6 +115,14 @@ class TestTextFileHandler:
assert result.endswith("\n```")
assert "def hello():" in result
def test_prepare_text_content_with_plantuml(self):
"""Test that PlantUML files are wrapped in plantuml code blocks."""
puml = "@startuml\nAlice -> Bob: Hello\n@enduml"
result = TextFileHandler.prepare_text_content(puml, ".puml")
assert result.startswith("```plantuml\n")
assert result.endswith("\n```")
assert "@startuml" in result
def test_prepare_text_content_without_code(self):
"""Test that plain text files are not wrapped."""
text = "Hello world"