From 101f631380db0cb5fab049c3f593c86b511b2cc4 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Sun, 1 Dec 2024 23:34:53 -0800 Subject: [PATCH] Add permalinks --- webgpu/lessons/resources/lesson.css | 6 ++++++ webgpu/lessons/resources/lesson.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/webgpu/lessons/resources/lesson.css b/webgpu/lessons/resources/lesson.css index 5cf474c8..ebed5e82 100644 --- a/webgpu/lessons/resources/lesson.css +++ b/webgpu/lessons/resources/lesson.css @@ -119,6 +119,12 @@ table { position: relative; } +.permalink>div { + position: absolute; + transform: translateX(-1em); + font-size: 19px; +} + .footnote { font-size: smaller; vertical-align: baseline; diff --git a/webgpu/lessons/resources/lesson.js b/webgpu/lessons/resources/lesson.js index a4b33990..3eb5bfe9 100644 --- a/webgpu/lessons/resources/lesson.js +++ b/webgpu/lessons/resources/lesson.js @@ -113,6 +113,12 @@ $(document).ready(function($) { }); $('[data-table]').html(); + $('a[id]:not([href])') + .addClass('permalink') + .each(function(i, e) { + $(e).attr('href', `#${$(e).attr('id')}`); + }) + .append(''); }); }(jQuery));