Skip to content

feat: print concise text with backticks - #159

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

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

Conversation

@LuLaValva

Copy link
Copy Markdown
Member

Teaches the formatter about backtick text in concise mode (htmljs-parser#260), and makes markoSyntax: "auto" keep the syntax each tag was written in.

Two commits:

  1. auto keeps each tag's syntax. Until now auto looked at the first tag and formatted the whole file in that syntax. Each tag now keeps its own, so a template can mix them, and an HTML tag beside text in a concise tag stays in the text, like p `concise mode is <em>sort of</em> concise` , instead of turning into a concise child. This is the part to look at for behavior changes: files that mixed syntaxes used to be rewritten into one.
  2. Backticks instead of --. Concise text is printed as div `hello and the optional closing backticks are left off. Leading and trailing whitespace is written between the backticks instead of as ${" "}, with closing backticks added only where trailing whitespace needs them. Longer text, and text beside sibling tags, becomes a block closed by a line of the same backticks. The opening fence is always longer than any backtick run in the text.

The second commit needs the parser changes, so this can't merge until htmljs-parser is released and its floor is raised here.

Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 06dcbb8

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

This PR includes changesets to release 1 package
Name Type
prettier-plugin-marko 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

LuLaValva and others added 2 commits October 13, 2026 10:50
markoSyntax auto used the syntax of the first tag for the whole file. It now
keeps the syntax each tag was written in, so a template can mix them. An inline
HTML tag beside text in a concise tag stays in the text instead of becoming a
concise child.

Co-Authored-By: Claude <noreply@anthropic.com>
Concise text is printed with backticks instead of --, leaving off the optional
closing backticks. Leading and trailing whitespace is written between the
backticks instead of as ${" "}, and trailing whitespace on a single line is kept
by closing backticks. Text on several lines beside sibling tags is closed by a
line of the same backticks, as is a comment after text. The opening backticks
are longer than any run of backticks in the text.

Co-Authored-By: Claude <noreply@anthropic.com>
@LuLaValva
LuLaValva force-pushed the llavalva-M451495HWX-marko-concise-vxgunp branch from 9273e86 to 06dcbb8 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