MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / scrollToHash

Function scrollToHash

src/pages/markdownPreview/index.js:351–363  ·  view source on GitHub ↗
(targetId)

Source from the content-addressed store, hash-verified

349 }
350
351 function scrollToHash(targetId) {
352 const target = getTargetElement(previewState.content, targetId);
353 if (!target) return;
354
355 const topOffset = 12;
356 const top =
357 getOffsetTopWithinContainer(target, previewState.content) - topOffset;
358
359 previewState.content.scrollTo({
360 top: Math.max(0, top),
361 behavior: "smooth",
362 });
363 }
364
365 async function enhanceCodeBlocks(version) {
366 const codeBlocks = Array.from(previewState.content.querySelectorAll("pre"));

Callers 2

onContentClickFunction · 0.85
renderFunction · 0.85

Calls 2

getTargetElementFunction · 0.85

Tested by

no test coverage detected