Skip to content

feat: Allow adding <body> scripts in a kobweb block in the build script#736

Closed
kocheick wants to merge 10 commits intovarabyte:devfrom
kocheick:dev
Closed

feat: Allow adding <body> scripts in a kobweb block in the build script#736
kocheick wants to merge 10 commits intovarabyte:devfrom
kocheick:dev

Conversation

@kocheick
Copy link
Copy Markdown

@kocheick kocheick commented Aug 21, 2025

Overview

This PR adds support for injecting custom <body> elements (such as scripts) directly through the Kobweb build configuration, enabling developers to add analytics, Bootstrap, and other scripts without modifying HTML templates.

What's Changed

  • Added serializeBodyContents utility for creating custom <body> content blocks
  • Enhanced index template generation to support custom <body> element injection
  • Added comprehensive logging during index generation for better visibility
  • Implemented build script configuration support for body content blocks

Use Cases

  • Adding analytics scripts (Google Analytics, etc.)
  • Including Bootstrap or other CSS/JS frameworks
  • Injecting custom scripts that need to be in the <body> tag
  • Any other custom HTML content that belongs in the document body

Testing

  • Tested with Bootstrap integration
  • Tested with analytics script injection
  • Verified proper HTML serialization and template integration

Breaking Changes

None - this is a purely additive feature that maintains backward compatibility.

Copy link
Copy Markdown
Member

@bitspittle bitspittle left a comment

Choose a reason for hiding this comment

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

Looks like your markdown changes got included in this PR. Can you fix / re-upload a new PR?

@kocheick
Copy link
Copy Markdown
Author

Looks like your markdown changes got included in this PR. Can you fix / re-upload a new PR?

Corrected, let me know if you have any feedback

- Add comprehensive footnotes support in KotlinRenderer
  - Footnote references rendered as superscript links
  - Footnote definitions rendered as block elements
  - Proper ID-based linking between references and definitions

- Enhance task list support in MarkdownHandlers
  - Automatic detection of task list patterns in all text contexts
  - Support for - [x] (checked) and - [ ] (unchecked) syntax
  - FontAwesome icons when Silk is available, HTML checkboxes fallback
  - Works in table cells and other complex structures

- Add footnotes feature configuration in MarkdownFeatures
  - Configurable footnotes support (enabled by default)
  - Integration with CommonMark FootnotesExtension

- Update playground with test examples for new features

Resolves issues with markdown rendering inconsistencies and adds
support for GitHub Flavored Markdown footnotes feature.
- Consolidate `footnotes` and `strikethrough` properties for clarity
- Adjust initialization sequence for extensions to ensure proper loading and maintain code readability
@kocheick kocheick changed the base branch from dev to main August 22, 2025 02:11
@kocheick kocheick changed the base branch from main to dev August 22, 2025 02:11
@kocheick
Copy link
Copy Markdown
Author

not sure what im doing wrong but its not working as expected. let me know if it makes more sense to close this PR and just make a separate and cleaner one for this issue

@bitspittle
Copy link
Copy Markdown
Member

not sure what im doing wrong but its not working as expected. let me know if it makes more sense to close this PR and just make a separate and cleaner one for this issue

Yeah go ahead and close and reopen.. If you are still running into issues let me know and I can help

@kocheick kocheick closed this Aug 22, 2025
@kocheick
Copy link
Copy Markdown
Author

new PR opened at #741

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.

2 participants