Skip to content

Description extractor raise error under certain document structures #237

Description

@7sDream
#import "@preview/shiroa:0.3.1": text-support
#import text-support: plain-text

#plain-text(table(), limit: 255)
$ typst compile .\test.typ                                                                                                                 
error: type none has no method `clusters`                                                                                                  
   ┌─ @preview/shiroa:0.3.1\supports-text-internal.typ:72:15
   │
72 │     assert(res.clusters().len() <= limit, message: "plain-text length limit exceeded")
   │                ^^^^^^^^

help: error occurred in this call of function `plain-text`
  ┌─ \\?\test.typ:4:1
  │
4 │ #plain-text(table(), limit: 255)
  │  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is because, for code here, empty table has a empty children array, make parts be an empty array, then join into none.

This is also true when the table is not empty, but all it's cells will be converted into empty string (only contains image, for example).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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