Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance HTML generation with hast for better extensibility and formatting #3

Open
MiguelFranken opened this issue Mar 24, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@MiguelFranken
Copy link
Collaborator

Our current implementation utilizes a custom data structure for representing generated HTML code, which is then converted into a string with our custom formatting logic. While this method serves its purpose, it's becoming apparent that adopting a more standardized approach could offer significant benefits. Specifically, integrating the hast (Hypertext/HTML Abstract Syntax Tree) package from the Unified Collective could streamline our processes and offer additional functionality through its ecosystem of plugins.

Current Implementation Details

  • Method: Custom data structure for HTML representation.
  • Conversion: Custom logic for transforming the data structure to a string (HTML to string transformation).
  • Formatting: Custom, internally developed formatting rules and logic.

Proposed Changes

  • Integrate hast Package: Shift from our custom implementation to using hast for representing HTML code in an AST format. hast is a part of the Unified Collective, a well-established ecosystem focusing on content as structured data.
  • Utilize rehype-format Plugin: Adopt the rehype-format plugin (rehypejs/rehype-format) to leverage its advanced formatting capabilities for the hast representation of our generated code. This will ensure that our HTML output is not only more standardized but also cleaner and easier to read.

Benefits of the Proposed Changes

  • Standardization: By using a widely adopted format like hast, our codebase aligns with industry standards, making it easier for new developers to understand and contribute.
  • Extensibility: The vast array of plugins available in the hast ecosystem opens up opportunities for future enhancements without significant custom development.
  • Improved Formatting: With rehype-format, we can automatically ensure consistent and readable code formatting, reducing the need for manual adjustments and reviews.
  • Community Support: Leveraging community-maintained packages often comes with the benefit of regular updates and a broader support network for troubleshooting and enhancements.
@MiguelFranken MiguelFranken self-assigned this Apr 16, 2024
@MiguelFranken MiguelFranken added the enhancement New feature or request label Apr 16, 2024
@MiguelFranken MiguelFranken moved this to Backlog in Onyx Board Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

1 participant