Skip to content

kronstein/htmlReplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

htmlReplace

License

HTML tag replacement tool for Kotlin (Java).

Required dependencies:

Example usage:

import kotlinx.html.*

htmlReplace(
    html = """
        <p>Allo, <q>Mars</q></p>
    """.trimIndent(),

    cssQuery = ":containsOwn(Mars)" to {
        a {
            href = "https://www.mars.com"
            unsafe {
                raw(it.outerHtml())
            }
        }
    }
)

Output:

<p>Allo, <a href="https://mars.com"><q>Mars</q></a></p>

How to use:

  • define cssQuery using JSoup syntax;
  • (optional) access original element properties: it.attributes(), it.html().

About

Replace tags in your HTML using JSoup and kotlinx.html

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages