Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change the text colour of a list #486

Open
AlejandroImbox opened this issue Oct 9, 2024 · 0 comments
Open

change the text colour of a list #486

AlejandroImbox opened this issue Oct 9, 2024 · 0 comments

Comments

@AlejandroImbox
Copy link

  • Markwon version: {4.6.2}

I want to change the text colour of a list of dots.
I am creating my custom class inheriting from TagHandler and in the handle method I am doing the following:

 override fun handle(visitor: MarkwonVisitor,  renderer: MarkwonHtmlRenderer,  tag: HtmlTag) {
        val info = extractValue(tag.attributes()["style"] ?: "")
        if(tag.name() == "span"){
            visitor.builder().setSpan(
                    ForegroundColorSpan(safeParseColor(info.trim())),
                    tag.start(),
                    tag.end()
            )
        }else if(tag.name() == "ul"){
            val list = tag.asBlock.children()
            if(list.isNotEmpty()){
                list.forEach {
                    visitor.builder().setSpan(
                            ForegroundColorSpan(safeParseColor(info.trim())),
                            it.start(),
                            it.end())
                }
            }
        }

    }

but the result I get is that it paints the text in the expected colour but the list is lost, i.e. it becomes a normal text with the colour changed.

any help please ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant