Skip to content

feat: backtick text in concise mode - #260

Draft
LuLaValva wants to merge 3 commits into
mainfrom
llavalva-M451495HWX-marko-concise-vxgunp
Draft

LuLaValva wants to merge 3 commits into
mainfrom
llavalva-M451495HWX-marko-concise-vxgunp

Conversation

@LuLaValva

Copy link
Copy Markdown
Member

Adds backticks as a way to write text in concise mode, alongside --:

p `Hello ${name}`
p `
  Several lines of text,
  closed by a line of the same backticks.
`

The text is exactly what follows the opening backticks, so leading and trailing whitespace is kept, and the closing backticks are optional on a single line. That makes inline markup much easier to read than with --, which has to skip a separator character and has no way to mark where trailing whitespace ends.

One thing that changes: a backtick after whitespace, where an attribute could start, used to be read as an attribute named by a template literal. It is now text.

The PR is three commits that read in order:

  1. A fix for a concise line that ends its open tag before any tag name (for example a line starting with ;). The parser emitted an open tag end with no name, which made consumers like the compiler throw. This one is independent of the rest and exists on main today.
  2. onText and onPlaceholder ranges now report the delimiter that began their text block, so tools like Prettier can print text back the way it was written.
  3. The backtick syntax itself.

Once this is released, the compiler and prettier-plugin-marko should raise their htmljs-parser floor together. Related PRs: Prettier and the language server grammar, in the other repos.

Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: aa421e0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
htmljs-parser Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.91%. Comparing base (3b59c74) to head (aa421e0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #260      +/-   ##
==========================================
+ Coverage   99.89%   99.91%   +0.02%     
==========================================
  Files          35       35              
  Lines        4711     4875     +164     
  Branches      912      949      +37     
==========================================
+ Hits         4706     4871     +165     
+ Misses          4        3       -1     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 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.

LuLaValva and others added 3 commits October 13, 2026 10:50
A concise line that ends its open tag before any tag name, such as a line that
starts with a semicolon, emitted an open tag end with no tag name. Consumers
that track the open tag, including the compiler, threw on it. It is now a parse
error.

Co-Authored-By: Claude <noreply@anthropic.com>
onText and onPlaceholder ranges now carry the range of the `--` run that began
the concise text block holding them, so consumers can tell how text was written
and print it back the same way.

Co-Authored-By: Claude <noreply@anthropic.com>
A run of backticks after a tag's attributes, or at the start of a line, begins
text like `--` does, either on one line or as an indented block closed by a
line of the same backticks. The text is exactly what follows the opening
backticks, so leading and trailing whitespace is kept. A closing run of the
same length is optional on a single line and may be followed by a comment.

A backtick after whitespace where an attribute could start was previously read
as an attribute named by the template literal. It is now text.

Co-Authored-By: Claude <noreply@anthropic.com>
@LuLaValva
LuLaValva force-pushed the llavalva-M451495HWX-marko-concise-vxgunp branch from e024b67 to aa421e0 Compare October 13, 2026 17:51
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