Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Kotlin Multiplatform library to render HTML content as Compose AnnotatedString, supporting basic formatting and hyperlinks.

License

NotificationsYou must be signed in to change notification settings

ch4rl3x/HtmlText

Repository files navigation

BuildCodeFactorMaven Central

HtmlText

HtmlText is a Kotlin Multiplatform library that allows you to render HTML content as ComposeAnnotatedStrings. It supports basic formatting, hyperlinks, and color styling in a multiplatform-friendly way.HtmlText has been made accessible for screen readers and keyboard operation.

Note

🚀 HtmlText is now Compose Multiplatform

Supported HTML tags

TagDescription
<b>Bold text
<i>Italic text
<strike>Strikethrough text
<u>Underlined text
<ul>Unordered list
<ol start="3" type="1">Ordered list (a., A., 1.)
<li>List item
<a href="...">Clickable link
<span>Colored text
<span>Colored text
<font color="#FF0000">Colored text
<font color="rgb(r,g,b)">Colored text

MaterialTheme colors in HtmlText

To use colors likeMaterialTheme.colors.primary inHtmlText, map simple colors.

HtmlText(    stringId=R.string.hello_world_cdata,    colorMapping=mapOf(Color.Red toMaterialTheme.colors.primary))
<resources>    <stringname="hello_world_escaped">Hello&lt;span&gt;World&lt;/span&gt;</string>    <stringname="hello_world_cdata"><![CDATA[Hello <span>World</span>]]></string></resources>

Preview

HtmlText

Dependency

Add actual HtmlText library:

dependencies {    implementation'de.charlex.compose.material:material-html-text:3.0.0-beta01'}

or

dependencies {    implementation'de.charlex.compose.material3:material3-html-text:3.0.0-beta01'}

License

Copyright 2021 Alexander KarkossaLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at   http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.

About

A Kotlin Multiplatform library to render HTML content as Compose AnnotatedString, supporting basic formatting and hyperlinks.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp