Skip to content

Enhancement(astral): Smart chunking of embed field dataΒ #75

@JacobCoffee

Description

@JacobCoffee

Summary

Embed fields are limited to <1024 characters, so we introduced chunking logic.

for idx, chunk in enumerate(chunk_sequence(formatted_rule_details["explanation"], 1000)):
embed.add_field(name="" if idx else "Explanation", value="".join(chunk), inline=False)

For the most part this does just fine, but it leads to ugly lines in embeds occasionally - and more importantly it can break markdown links provided by the ruff output

image

Basic Example

Make the chunking "smarter" to not break lines at awkward places

Drawbacks and Impact

No response

Unresolved questions

  • how

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions