Skip to content

Extract snippet preprocessor#935

Merged
rr404 merged 4 commits intomainfrom
jdv-extract-plugin
Mar 23, 2026
Merged

Extract snippet preprocessor#935
rr404 merged 4 commits intomainfrom
jdv-extract-plugin

Conversation

@rr404
Copy link
Contributor

@rr404 rr404 commented Nov 24, 2025

(Needs rebase on main rather than stack health)

Allows to copy the content of elements with data-extract attribute into elements with data-extract-copy attribute matching <page_id>:<data-extract_key>

example in this PR:

How it works:
in page id console_issues:

<div data-extract="stackhealth_issues_list">

Some text
</div>

in any other page

@aws-amplify-eu-west-1
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-935.d1to60jd2gb6y6.amplifyapp.com

@rr404 rr404 changed the base branch from main to jdv-stack_health_issues_v1 November 24, 2025 21:08
@rr404 rr404 marked this pull request as draft November 24, 2025 21:08
Base automatically changed from jdv-stack_health_issues_v1 to main November 26, 2025 08:52
@rr404 rr404 closed this Dec 11, 2025
@rr404 rr404 force-pushed the jdv-extract-plugin branch from b6bd5ce to 6c471f5 Compare December 11, 2025 15:46
@rr404 rr404 reopened this Dec 11, 2025
@rr404 rr404 marked this pull request as ready for review December 11, 2025 15:58
- 🌟 **Bonus** : Optimization advises and upper tier recommendation with great return on value *(comming in next iterations of Stack Health)*

## Health Check Issues Overview
<div data-extract="stackhealth_issues_list">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the div once the extracts have been indexed

});

isIndexed = true;
console.log(`[ExtractPreprocessor] ⚡ Indexed ${count} snippets.`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now remove all divs that have been indexed


// Regex to find: <div data-extract="ID"> CONTENT </div>
// We use [\s\S]*? to match content across multiple lines (lazy match)
const extractRegex = /<div\s+data-extract=["']([^"']+)["'][^>]*>([\s\S]*?)<\/div>/g;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try using a custom tag, if it's removed docusauus shjould not be bothered

@rr404 rr404 merged commit c8f3923 into main Mar 23, 2026
3 checks passed
@rr404 rr404 deleted the jdv-extract-plugin branch March 23, 2026 11:19
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

Successfully merging this pull request may close these issues.

1 participant