Skip to content

feat(html/unstable): html()#7130

Open
iuioiua wants to merge 4 commits into
denoland:mainfrom
iuioiua:unstable-html
Open

feat(html/unstable): html()#7130
iuioiua wants to merge 4 commits into
denoland:mainfrom
iuioiua:unstable-html

Conversation

@iuioiua
Copy link
Copy Markdown
Contributor

@iuioiua iuioiua commented May 7, 2026

This function really does almost nothing except return the strings fed to it. Its purpose is to "functionalise" HTML string generation while enabling the HTML content to be formatted by Deno's inbuilt formatter.

I use this function a lot and it works like a charm. To any future devs wanting to add functionality or over-engineer this function, please don't! 🤣

Closes #6726

Mostly written by me. Checked by Claude Code.

@github-actions github-actions Bot added the html label May 7, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.61%. Comparing base (a496da2) to head (d7031db).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7130      +/-   ##
==========================================
- Coverage   94.61%   94.61%   -0.01%     
==========================================
  Files         634      635       +1     
  Lines       51801    51799       -2     
  Branches     9329     9328       -1     
==========================================
- Hits        49011    49009       -2     
  Misses       2216     2216              
  Partials      574      574              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the http label May 8, 2026
Copy link
Copy Markdown

@fibibot fibibot left a comment

Choose a reason for hiding this comment

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

Implementation matches the function it removes from http/file_server.ts:441-451 — the reduce form is semantically equivalent because strings.length === values.length + 1 always holds, so the trailing values[strings.length-1] ?? "" resolves to "". The JSDoc security warning is appropriately load-bearing for a tag that does no escaping. Tests cover interpolation, undefined, no-interp, empty string, and the no-escape contract. mod.ts correctly does not re-export, and the ./unstable-html export entry is in deno.json. CI green.

  • nit: test name Deno.test("html()", ...) doesn't follow the repo-convention symbolName() does X when Y form — something like "html() concatenates strings with interpolated values" would be clearer. The other four cases match the convention.

@fibibot
Copy link
Copy Markdown

fibibot commented May 13, 2026

@bartlomieju this is ready to merge

Copy link
Copy Markdown
Contributor

@lunadogbot lunadogbot left a comment

Choose a reason for hiding this comment

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

The new html() matches the local copy it replaces in http/file_server.ts line-for-line (both treat undefined/null as "" via ?? "", both append in source order), and the file-server import dedupes the second copy — net change is one shared implementation, not a behaviour change. Tests cover empty-string and no-interpolation edge cases plus the explicit "does not escape" contract. CI is green.

  • nit: JSDoc says "Undefined values are treated as empty strings", but ?? "" also coalesces null. Either tighten the impl to === undefined or extend the sentence to "Undefined and null values…".

@lunadogbot
Copy link
Copy Markdown
Contributor

@bartlomieju this is ready to merge

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

suggestion: add html() tagged template function

3 participants