Skip to content

Commit

Permalink
chore: prepare README and CHANGELOG for release 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeyls committed Oct 19, 2024
1 parent e264b73 commit 98acc3d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Change Log
==========

## Version 1.0.2

_2024-10-20_

Bug fix:
- Display the correct number of line breaks when a `<br>` tag is present between blocks requiring a single line break.

New features:
- Allow disabling paragraph logic completely by setting an undefined indent unit to work around a bug in Compose UI.

This release depends on:
- Kotlin **2.0.21**
- Compose Multiplatform **1.7.0** (Jetpack Compose UI **1.7.1**)

## Version 1.0.1

_2024-10-17_
Expand Down
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Add the dependency to your **module**'s `build.gradle` or `build.gradle.kts` fil

```kotlin
dependencies {
implementation("be.digitalia.compose.htmlconverter:htmlconverter:1.0.1")
implementation("be.digitalia.compose.htmlconverter:htmlconverter:1.0.2")
}
```

Expand All @@ -34,7 +34,7 @@ For Kotlin Multiplatform projects:
sourceSets {
val commonMain by getting {
dependencies {
implementation("be.digitalia.compose.htmlconverter:htmlconverter:1.0.1")
implementation("be.digitalia.compose.htmlconverter:htmlconverter:1.0.2")
}
}
}
Expand Down Expand Up @@ -66,7 +66,7 @@ Both functions take an optional `compactMode` boolean argument. When set to `tru
The `htmlToAnnotatedString()` function takes an optional `style` argument of type `HtmlStyle` which allows to customize styling. The currently provided options are:

- `textLinkStyles`: Optional collection of styles for hyperlinks (content of `a` tags). Default is a simple underline. When set to `null`, hyperlinks will not be styled, which can be useful when they are not clickable (see next section).
- `indentUnit`: Unit of indentation for block quotations and nested lists. Default is **24 sp**. Note that `em` units are not yet supported for indentation in Compose Desktop.
- `indentUnit`: Unit of indentation for block quotations and nested lists. Default is **24 sp**. Note that `em` units are not yet supported for indentation in Compose Desktop. Set to `0.sp` or `TextUnit.Unspecified` to disable indentation support.

For example, here is how to style hyperlinks to use the theme's primary color with no underline:

Expand Down Expand Up @@ -111,6 +111,29 @@ Text(
)
```

### Bug when showing hyperlinks in combination with maxLines

Compose UI 1.7.x has an unsolved bug which triggers a crash when a `Text` composable using `maxLines` is displaying an `AnnotatedString` containing a `LinkAnnotation` inside a paragraph.

This library is vulnerable to that bug because it uses both `LinkAnnotation` to display hyperlinks and paragraphs to handle text indentation.

As a workaround, you can disable indentation support in `Text` composables which require the usage of `maxLines`:

```kotlin
val convertedText = remember(html) {
htmlToAnnotatedString(
html,
style = HtmlStyle(indentUnit = TextUnit.Unspecified)
)
}
Text(
text = convertedText,
maxLines = 3
)
```

See related bug reports [374115892](https://issuetracker.google.com/issues/374115892), [372390054](https://issuetracker.google.com/issues/372390054) on the Google issue tracker.

### Custom parsing

The `htmlToAnnotatedString()` and `htmlToString()` functions provide an overload that accepts an `HTMLParser` first argument in place of a `String`.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SONATYPE_CLOSE_TIMEOUT_SECONDS=1500
RELEASE_SIGNING_ENABLED=true

GROUP=be.digitalia.compose.htmlconverter
VERSION_NAME=1.0.1
VERSION_NAME=1.0.2

POM_DESCRIPTION=HTML Converter for Compose
POM_URL=https://github.com/cbeyls/HtmlConverterCompose
Expand Down

0 comments on commit 98acc3d

Please sign in to comment.