aws-samples / aws-samples/amazon-textract-response-parser

JS - Clarification on Rendering Signatures in HTML Output and Markdown Support

Open
#188 1 comment 0 reactions 0 assignees View on GitHub
javascript
Dominant language
TypeScript
Stars
236
Forks
97
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm currently using the following code to generate HTML content while skipping certain block types:
```
const htmlContent = page.html({
skipBlockTypes: ['LAYOUT_FOOTER' as ApiBlockType, 'LAYOUT_FIGURE' as ApiBlockType],
});
```

However, I noticed that signatures are not included in the HTML output. To handle this, I found that I need to manually search for signature blocks using:

```
const signatureBlocks = page.listSignatures().map(signature => {
return signature.str(); // Placeholder like [SIGNATURE]
});
```

Alternatively, I was exploring the idea of generating a full page in Markdown for more flexibility. I was also debating on using https://github.com/mixmark-io/turndown to covert html to makrdown.

For instance, using getLinesByLayoutArea to segment the page covert each page into html and into markdown after:

```
const segmented = page.getLinesByLayoutArea(true); // Sort lines in reading order

console.log("---- HEADER:");
console.log(segmented.header.map((l) => l.text).join("\n"));
console.log("\n---- CONTENT:");
console.log(segmented.content.map((l) => l.text).join("\n"));
console.log("\n---- FOOTER:");
console.log(segmented.footer.map((l) => l.text).join("\n"));
```

While this works, rendering the signature within the HTML feels a bit cumbersome. Is there a more streamlined way to include signature blocks in the HTML? Additionally, I was wondering if there are any plans to introduce a Markdown rendering option for JavaScript in the near future. It could be helpful for those of us working with simpler, more flexible outputs.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.