feat: add llms.txt markdown parser

This commit is contained in:
Edgar I.
2025-10-24 13:21:03 +04:00
parent 60fefb6c0b
commit a18ea8cf68
2 changed files with 108 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import pytest
from cli.llms_txt_parser import LlmsTxtParser
def test_parse_markdown_sections():
"""Test parsing markdown into page sections"""
sample_content = """# Getting Started
Welcome to the docs.
## Installation
Run: npm install
## Usage
Import the library:
```javascript
import { app } from 'framework'
```
# API Reference
Main API documentation here.
"""
parser = LlmsTxtParser(sample_content)
pages = parser.parse()
assert len(pages) >= 2
assert pages[0]['title'] == 'Getting Started'
assert pages[1]['title'] == 'API Reference'
assert len(pages[0]['code_samples']) == 1
assert pages[0]['code_samples'][0]['language'] == 'javascript'