Skip to content

Conversation

@MarcelGeo
Copy link
Contributor

Fixes #656

  • here is a issue in chromium browsers where image height is not calculated properly (probably this is related: https://issues.chromium.org/issues/40753240)
  • anchor links were not placed properly on pages with images (fresh open)

Solution

After some discussion with @brc-dd in vitepress issues (see: vuejs/vitepress#5079), following improvements were implemented:

  • added markdown plugin to calculate width and height for each image from content
  • added improvement to lite-youtube component using css to proper scrolling
  • Precalulate images height and width with maxHeight = 500px to every image in markdown

@MarcelGeo MarcelGeo requested a review from varmar05 January 9, 2026 14:06
@@ -1,5 +1,5 @@
// https://vitepress.dev/guide/custom-theme
import { h } from "vue";
import { h, nextTick, watch } from "vue";
Copy link

Choose a reason for hiding this comment

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

the imports can be reverted back

Comment on lines +160 to +163
h1, h2, h3, h4, h5{
/** For proper anchor offset when using scroll to hash links */
scroll-margin-top: 60px;
}
Copy link

Choose a reason for hiding this comment

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

scroll-margin-top is not yet respected by vitepress' router. If you want this it needs to be configured in .vitepress/config, but the defaults already calculate the offset depending on the height on navbar, etc.. Probably can be removed.

Comment on lines +49 to +52
if (style.length > 0) {
const sep = existingStyle && !existingStyle.trim().endsWith(';') ? ';' : ''
token.attrSet('style', existingStyle + sep + style.join(' '))
}
Copy link

Choose a reason for hiding this comment

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

This version works, but probably can be synced with the edits on the vitepress issue. I had made it simpler (just using string for styles as there is only one concat needed).

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.

Links to headers sometimes work correctly only after page refresh

4 participants