Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support rewriting a doc's image source to the current branch #252

Merged
merged 8 commits into from
Jul 14, 2024

Conversation

SeanCassiere
Copy link
Member

@SeanCassiere SeanCassiere commented Jul 13, 2024

Important

This change should have zero impact on the current status of the docs, instead it should make it easier for us to manage images in the future.

From this discussion with Tanner: https://discord.com/channels/719702312431386674/1252133993172697098

Right now, when any of the TanStack projects move to a new major version, we keep all the content of the previous major versions in their own branches. Since we generally have a "main" branch, old branches (v1, v2, ...), and future branches (alpha, beta, ...), this creates a problem when we need to show images in the markdown content in the respective projects.

Currently, when including an image source like https://github.com/TanStack/router/main/docs/assets/beta.png it gets rendered from markdown "as-is" regardless of which branch the doc is in. This creates a problem where this image's source would need to remain "as-is" without ANY changes to its name or content till the end of time since it'd have possible effects on the docs for the older branches. Should you decide to make a change to the image source (filename or content) in a documentation markdown file, it'd need massive amounts of coordination since changes would need to be made to all of the previous versions as well.

With this change, it'd lock the image source's branch to whatever the current reference branch is provided the source is the same project's repo.

When the project is "router" and the current branch is "alpha", with the image pointing at "main", it'll be rewritten to point at "alpha":

input: https://github.com/TanStack/router/main/docs/assets/main.png
output: https://github.com/TanStack/router/alpha/docs/assets/main.png

When the project is "router" and the current branch is "alpha", an image from "Table" will be returned as-is.

input: https://github.com/TanStack/table/main/docs/assets/main.png
output: https://github.com/TanStack/table/main/docs/assets/main.png

Copy link

vercel bot commented Jul 13, 2024

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

Name Status Preview Comments Updated (UTC)
tanstack-com ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 14, 2024 0:45am

@SeanCassiere SeanCassiere changed the title feat: support rewriting a doc's image src to the respective origin branch feat: support rewriting a doc's image source to the current branch Jul 13, 2024
@SeanCassiere SeanCassiere merged commit 2589a8b into main Jul 14, 2024
4 checks passed
@SeanCassiere SeanCassiere deleted the doc-images-by-their-branch branch July 14, 2024 05:20
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