Skip to content

fix: rewrite smart quotes logic#1325

Draft
Ocean-OS wants to merge 24 commits into
sveltejs:mainfrom
Ocean-OS:fix-smart-quotes
Draft

fix: rewrite smart quotes logic#1325
Ocean-OS wants to merge 24 commits into
sveltejs:mainfrom
Ocean-OS:fix-smart-quotes

Conversation

@Ocean-OS

@Ocean-OS Ocean-OS commented Apr 28, 2025

Copy link
Copy Markdown
Member

Closes #781. I'm not entirely sure on what first does, or if I'm using it correctly in the logic, but everything else should be good.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time.
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.

@vercel

vercel Bot commented Apr 28, 2025

Copy link
Copy Markdown

@Ocean-OS is attempting to deploy a commit to the Svelte Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Apr 30, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
svelte-dev Error Error Jun 6, 2026 1:16pm

Comment thread packages/site-kit/src/lib/markdown/utils.ts
@teemingc

teemingc commented Aug 1, 2025

Copy link
Copy Markdown
Member

I'm not entirely sure on what first does

I think first is used to tell if we're in a complete sentence or substring. It's only being used when we're processing the shiki tokens token by token so that a substring such as example" that's part of a bigger string "an example" will get the right quotation direction.

Comment thread packages/site-kit/src/lib/markdown/utils.ts

@teemingc teemingc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The new approach seems to error in cases where a title has a single quote character such as https://svelte.dev/docs/kit/images#Vite's-built-in-handling . It changes the single quote to a left single quote when it should be a right single quote as it is currently.

Possible edge cases we should account for:
a) Vite's built-in handling (right single quote)
b) "Vite's built-in handling" (smart double quotes with right single quote)
c) <script lang="ts"> (smart double quotes but in a single word)

I wonder if it's worth adding a unit test for this but I can see we don't have Vitest set up despite having a test command in the root package.json

@teemingc teemingc self-requested a review February 24, 2026 22:23
@teemingc teemingc marked this pull request as draft February 24, 2026 22:27
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.

more smart quote woes

3 participants