Skip to content

Commit

Permalink
fix invisible link for h tags (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
alidevjimmy authored Jan 11, 2025
1 parent 30be010 commit 460a0bb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 62 deletions.
1 change: 0 additions & 1 deletion assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { defineElement } from "@lordicon/element";
defineElement(lottie.loadAnimation);

$(document).ready(function () {

const copybtn = `<div style="background: #0F6CBD" class="p-1 place-items-center text-sm flex rounded-lg"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7H5a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-3M8 7V5a2 2 0 012-2h5a2 2 0 012 2v3M8 7h8a2 2 0 012 2v8"></path></svg> Copy</div>`
$('pre').each(function() {
var copyButton = $('<button>')
Expand Down
8 changes: 4 additions & 4 deletions content/download.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ On this page you can find how to download and get the latest version of the Pact

---

<h3 id="build">🏗️ Compile from Source Code</h3>
### 🏗️ Compile from Source Code {#build}

Project Pactus is distributed as open source software,
so the preferred way for installing it is to clone the source code from
Expand All @@ -23,15 +23,15 @@ Instructions for compiling Pactus is provided on the

---

<h3 id="binary">⬇️ Download Stable Releases</h3>
### ⬇️ Download Stable Releases {#binary}

You can also download the latest stable releases of Pactus.
These releases are updated automatically when a new version is released in
[GitHub repository](https://github.com/pactus-project/pactus).

{{<download_links>}}

<h3 id="downloader_script">Downloader script</h3>
### Downloader script {#downloader_script}

For [Unix-like systems](https://en.wikipedia.org/wiki/Unix-like)
[e.g., Linux, macOS, or [MSYS2](https://en.wikipedia.org/wiki/Mingw-w64#MSYS2) on Windows],
Expand All @@ -45,7 +45,7 @@ curl --proto '=https' --tlsv1.2 -sSL <span class="release-tag-link">---</span>/p

---

<h3 id="docker">🐳 Docker Container</h3>
### 🐳 Docker Container {#docker}

Advanced users can get the Pactus docker image from [Docker Hub](https://hub.docker.com/r/pactus/pactus).

Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/_markup/render-heading.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
<path stroke-linecap="round" stroke-linejoin="round" d="M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5l-3.9 19.5m-2.1-19.5l-3.9 19.5" />
</svg>
</a>
</h{{ .Level }}>
</h{{ .Level }}>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h1 class="md:text-4xl text-3xl font-bold text-neutral-50 text-left">
</svg>
</div>
</div>
<article class="prose lg:prose-xl">{{ .Content | safeHTML }}</article>
<article class="prose lg:prose-xl">{{ .Content }}</article>
</section>
{{ end }}
{{ define "page_script" }}
Expand Down
55 changes: 0 additions & 55 deletions layouts/partials/single-scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,61 +5,6 @@


<script src="/js/lazyload.min.js"></script>
<script>
$(document).ready(function () {
$(".prose h2, .prose h3, .prose h4, .prose h5, .prose h6").each(
function () {
var $header = $(this);
var id = $header.attr("id");

if (id) {
var $link = $("<a>", {
href: "#" + id,
class:
"ml-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200",
"aria-label": "Link to this section",
}).append(
$("<svg>", {
xmlns: "http://www.w3.org/2000/svg",
fill: "none",
viewBox: "0 0 24 24",
"stroke-width": "1.5",
stroke: "currentColor",
class: "w-5 h-5",
}).append(
$("<path>", {
"stroke-linecap": "round",
"stroke-linejoin": "round",
d: "M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5l-3.9 19.5m-2.1-19.5l-3.9 19.5",
}),
),
);

$header.append($link);
$header.addClass("group flex items-center");
}
},
);

$('.prose a[href^="#"]').on("click", function (event) {
event.preventDefault();

var target = $(this.getAttribute("href"));

if (target.length) {
$("html, body").animate(
{
scrollTop: target.offset().top - 100, // Adjust the '100' value as needed for your layout
},
500,
); // Adjust the duration (in milliseconds) as needed

// Update URL without reloading the page
history.pushState(null, null, this.getAttribute("href"));
}
});
});
</script>

<script>
$(document).ready(function () {
Expand Down

0 comments on commit 460a0bb

Please sign in to comment.