🚀 LLML TypeScript - Lightweight Language Markup Language
The most elegant way to generate structured text in TypeScript/JavaScript.
LLML transforms your data into beautifully formatted XML-like markup with zero fuss and maximum flexibility. Perfect for prompt engineering, configuration generation, and structured document creation.
⚡ Quick Start
import { llml } from './src';
console.log(llml({ greeting: "Hello World" }));
console.log(llml({ tasks: ["Buy milk", "Walk dog", "Code LLML"] }));
console.log(llml({
title: "My Project",
features: ["Fast", "Simple", "Powerful"],
config: { debug: true, version: "1.0" }
}));
🎯 Why LLML?
- 🔥 Zero Learning Curve: One function, infinite possibilities
- 🎨 Beautiful Output: Automatically formatted, properly indented
- ⚡ Lightning Fast: Minimal overhead, maximum performance
- 🌟 Modern TypeScript: Fully typed with excellent IDE support
- 🔧 Zero Dependencies: Only requires
dedent for multiline handling
🛠️ Installation
bun install
npm install
yarn install
📚 Advanced Usage
Automatic Key Conversion
LLML automatically converts all keys to kebab-case for consistency:
console.log(llml({
userName: "Alice",
user_age: 30,
"user email": "alice@example.com"
}));
console.log(llml({ XMLHttpRequest: "api", HTMLElement: "dom" }));
Prefix Support
console.log(llml({ message: "Hello" }, { prefix: "app" }));
Multi-line Content
const instructions = `
Step 1: Install LLML
Step 2: Import llml
Step 3: Create magic
`;
console.log(llml({ instructions }));
Complex Nested Structures
const promptData = {
system: "You are a helpful assistant",
rules: [
"Be concise and clear",
"Provide examples when helpful",
"Ask clarifying questions"
],
context: {
userLevel: "beginner",
topic: "TypeScript programming"
}
};
console.log(llml(promptData));
🎪 Use Cases
🤖 AI Prompt Engineering
Perfect for structuring complex prompts:
const prompt = llml({
role: "Senior TypeScript Developer",
task: "Code review the following function",
criteria: ["Performance", "Readability", "Best practices"],
code: functionToReview
});
⚙️ Configuration Generation
Generate clean config files:
const config = llml({
database: { host: "localhost", port: 5432 },
features: ["logging", "caching", "monitoring"],
environment: "production"
});
📄 Document Structure
Create structured documents:
const document = llml({
title: "API Documentation",
sections: ["Authentication", "Endpoints", "Examples"],
metadata: { version: "2.1", author: "Dev Team" }
});
🧪 Testing
Run the comprehensive test suite:
bun test
bun test:watch
bun test --coverage
Test Coverage
The test suite covers:
- ✅ Basic value formatting
- ✅ Complex nested structures
- ✅ List and array handling
- ✅ Kebab-case key conversion (camelCase, snake_case, spaces)
- ✅ Multiline content processing
- ✅ Prefix functionality
- ✅ Indentation control
- ✅ Edge cases and error handling
🌐 Runtime Compatibility
LLML TypeScript supports:
- ✅ Node.js 16+
- ✅ Bun runtime
- ✅ Deno (with npm imports)
- ✅ Modern browsers (ES2020+)
🏗️ Development
git clone https://github.com/yourusername/llml.git
cd llml/ts
bun install
bun test
bun test:watch
bun run tsc --noEmit
📖 API Reference
llml(data, options?)
Parameters:
data: any - The data to convert to markup
options?: LLMLOptions - Optional configuration
Options:
interface LLMLOptions {
indent?: string;
prefix?: string;
}
Returns: string - The formatted markup
Examples:
llml({ name: "John" })
llml({ name: "John" }, { prefix: "user", indent: " " })
llml({
users: [
{ name: "Alice", age: 30 },
{ name: "Bob", age: 25 }
]
})
🤝 Contributing
We love contributions! Whether it's:
- 🐛 Bug reports
- 💡 Feature requests
- 📝 Documentation improvements
- 🔧 Code contributions
Check out our contribution guidelines to get started.
📄 License
MIT License - see LICENSE file for details.
🌟 Star History
If LLML makes your life easier, give us a star! ⭐
Made with ❤️ for the TypeScript community
LLML: Because beautiful markup shouldn't be hard.