Skip to content

Infallible ANSI to HTML conversion #64

Description

@CosmicHorrorDev

Currently there are a small handful of scenarios where ansi_to_html::convert() can return an error. Specifically it's

  • Error::ParseInt(std::num::ParseIntError) gets returned if there's a number in an ansi code that's outside the 8-bit range e.g. \e[256m
  • Error::Invalid { msg: String } which can be returned when

I think it would be reasonable to instead ignore all of the current errors as invalid ansi codes instead of bailing out with an error. We could take an (optional?) dependency on some logging library and log some warning instead, or we could have an API that allows for returning the converted texts along with errors (and if so I would recommend returning a span indicating where the problematic text is and a more well typed error than a message String)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions