Skip to content

cinkhangin/composer

Repository files navigation

Composer

A markup language and renderer for Android Compose.

🚀 About

Composer is a powerful markup language and renderer designed for Android Jetpack Compose. It allows for structured text formatting with headings, syntax highlighting, colors, and more.

📦 Features

  • Headings: Supports multiple levels of headings.
  • Inline Styling: Bold, italic, underlined, strikethrough text.
  • Code Blocks: Syntax highlighting for Kotlin and Python.
  • Quotes: Render block quotes.
  • Tables: Supports structured tabular data.
  • Lists: unordered, and checklists.
  • Hyperlinks & Images: Embed links and images easily.
  • Date & Time Formatting: Supports dynamic placeholders.

Usage

 ComposerUI(
    modifier = Modifier.padding(16.dp),
    source = sourceText,
    onClickLink = {
       //link is clicked
    },
)

Implementation

Gradle

add a dependency

dependencies {
    implementation("com.naulian:composer:0.1.0")
}

🎯 Syntax Guide

Headings

    #1 heading 1
    #2 heading 2
    #3 heading 3
    #4 heading 4
    #5 heading 5
    #6 heading 6

Line Separator

=line=

Ignoring Syntax

`ignore ~syntax~ here`

Inline Text Formatting

Lorem ipsum dolor sit <amet, (.kt val name = "hello") consectetur#FF0000> adipiscing elit.
<color this text#FF0000>

Bold &bold text&

Italic /italic text/

Underlined _underlined text_

Strikethrough ~strikethrough text~

Date and Time Formatting

date: %dd/MM/yyyy%
Current time : $time

Quotes

"this is quote text -author"

Code Blocks

Kotlin

{.kt
fun main(varargs args: String) {
    println("Hello World!")
    val currentMillis = System.currentTimeMillis()
    println("Current time in millis: $currentMillis")
    // output : $millis
}}

Python

{
.py
def main():
    print("Hello World!")
    
if __name__ == '__main__':
    main()
}

Links and Images

Search (here@http://www.google.com) for anything.
(img@https://picsum.photos/id/67/300/200)

Tables

[
a      |b    |result
true   |true |true  
true   |false|false 
&false&|false|false 
]

Lists

Unordered List

* list item
* list item

Checklist

*o uncheck item
*x checked item

🤝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch (feature-branch)
  3. Commit your changes.
  4. Push to the branch and submit a pull request.

📜 License

This project is licensed under the The Apache License, Version 2.0.

📬 Contact

For issues or suggestions, open an issue or reach out at [email protected].

About

A markup language and renderer for compose

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages