Skip to content

Svelte Markdown example (Remark, Rehype, Svelte Components) - #587

Open
git-no wants to merge 7 commits into
sdorra:mainfrom
git-no:svelte-example
Open

Svelte Markdown example (Remark, Rehype, Svelte Components)#587
git-no wants to merge 7 commits into
sdorra:mainfrom
git-no:svelte-example

Conversation

@git-no

@git-no git-no commented Jun 8, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@vercel

vercel Bot commented Jun 8, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
content-collections ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 16, 2025 11:44am

@git-no

git-no commented Jun 8, 2025

Copy link
Copy Markdown
Contributor Author

Vite 6 is recommended

@sdorra

sdorra commented Jun 8, 2025

Copy link
Copy Markdown
Owner

@git-no Can you add the pnpm-lock.yaml after a pnpm install?

@changeset-bot

changeset-bot Bot commented Jun 8, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e233a2c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@git-no

git-no commented Jun 8, 2025

Copy link
Copy Markdown
Contributor Author

@sdorra pnpm-lockfile is now integrated.

My build locally failed with

samples-arktype:build: sh: Zeile 1: content-collections: Kommando nicht gefunden.
samples-xml:build: sh: Zeile 1: content-collections: Kommando nicht gefunden.
samples-cli:build: sh: Zeile 1: content-collections: Kommando nicht gefunden.
samples-arktype:build:  ELIFECYCLE  Command failed.
samples-xml:build:  ELIFECYCLE  Command failed.
samples-cli:build:  ELIFECYCLE  Command failed.
samples-valibot:build: 
samples-valibot:build: > samples-valibot@0.1.0 build /Users/lukas/code/labs/svelte-content-collections/samples/valibot
samples-valibot:build: > content-collections build
samples-valibot:build: 
@content-collections/remix-vite:build: cache miss, executing 2d16bb4e9a8811e9
@content-collections/vinxi:build: cache miss, executing 29946ae7386e1a66
@content-collections/remix-vite:build: 
samples-valibot:build: sh: Zeile 1: content-collections: Kommando nicht gefunden.
samples-valibot:build:  ELIFECYCLE  Command failed.
@content-collections/vinxi:build: 
samples-xml:build: ERROR: command finished with error: command (/Users/lukas/code/labs/svelte-content-collections/samples/xml) /Users/lukas/Library/pnpm/.tools/pnpm/8.15.8/bin/pnpm run build exited (1)
@content-collections/vinxi:build: 
@content-collections/remix-vite:build: 
samples-xml#build: command (/Users/lukas/code/labs/svelte-content-collections/samples/xml) 

 Tasks:    8 successful, 15 total
Cached:    0 cached, 15 total
  Time:    5.133s 
Failed:    samples-xml#build

 ERROR  run failed: command  exited (1)
 ELIFECYCLE  Command failed with exit code 1.

@git-no

git-no commented Jun 9, 2025

Copy link
Copy Markdown
Contributor Author

@sdorra Are there any plans to update Vite to version 6 in the repository?

@sdorra

sdorra commented Jun 10, 2025

Copy link
Copy Markdown
Owner

Are there any plans to update Vite to version 6 in the repository?

No concrete plans yet. Once I finish the work on #471 and then #494, I will make the long-overdue upgrades to Next and Vite. For Vite, we need to ensure compatibility with v5 and v6.

My build locally failed with

The problem is that these tests use the content-collections CLI, which must be built first. To test a fresh clone of content-collections, follow these steps:

# install dependencies
pnpm install
# build the cli
pnpm build --filter=@content-collections/cli
# ensure the cli is linked
pnpm install
# build all packages
pnpm build
# run the tests
pnpm test

This should probably be in the README 🤔

@sdorra

sdorra commented Jun 10, 2025

Copy link
Copy Markdown
Owner

The ci process still ends with the following error:

ERR_PNPM_OUTDATED_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with samples/svelte-kit/package.json

Have you done a pnpm install on the root of the monorepo?

Comment thread samples/svelte-kit/package.json Outdated
"vite": "^5.4.6"
"@content-collections/core": "workspace:*",
"@content-collections/markdown": "workspace:*",
"@content-collections/vite": "workspace:*",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Please keep the fixed versions. They have to be fixed because the samples must be openable in StackBlitz, and StackBlitz only looks at the folder of the sample, not the whole repo.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no problem, I did rewrite these entries.

@git-no

git-no commented Jun 12, 2025

Copy link
Copy Markdown
Contributor Author

@sdorra "Please keep the fixed versions. "

I do not get it? What do you like to have in package.json, my version or the previous version with Vite 5?

Just pnpm build did not work.
Building worked by following your steps.
But still pnpm test at the end fails.

@sdorra

sdorra commented Jun 12, 2025

Copy link
Copy Markdown
Owner

You have changed the version of the @content-collections/* packages to workspace:*, which is incompatible with the sparse checkout of StackBlitz.

Please retain the old versions of the @content-collections/* packages. The other packages can be upgraded. After reverting the versions, run pnpm install on the root package.json of the monorepo, and then commit the package.json and pnpm-lock.yaml.

I am currently not at home and will return on Sunday. I will review the failing tests then.

@sdorra

sdorra commented Jun 15, 2025

Copy link
Copy Markdown
Owner

I've added some styling and sample posts. I will update the tests tomorrow, and then we can merge the PR.

@sdorra

sdorra commented Jun 16, 2025

Copy link
Copy Markdown
Owner

@git-no i've updated the sample to match the look and feel of the other (newer) samples. The build and the tests are working now. But i've noticed that every svelte component i've used inside markdown is wrapped in a p tag. Is there a way to get rid of the p?

@git-no

git-no commented Jun 17, 2025

Copy link
Copy Markdown
Contributor Author

I will check next week.

@git-no

git-no commented Jun 21, 2025

Copy link
Copy Markdown
Contributor Author

@sdorra
I can not reproduce the issue you mentioned. My tests worked as expected:

  1. A Svelte component within a text is included in the <p>.
  2. A Svelte component at line start is integrated without <p>.

Do you have an example / repository?

@sdorra

sdorra commented Jun 22, 2025

Copy link
Copy Markdown
Owner

Do you have an example / repository?

Yeah, this pull request. Each MD file uses a different Svelte component and all of them a wrapped with a p tag.

@sdorra
sdorra force-pushed the main branch 2 times, most recently from 1e28b7f to 50aead7 Compare July 10, 2025 19:02
@sdorra
sdorra force-pushed the main branch 2 times, most recently from eb76dde to 759321d Compare October 2, 2025 12:39
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