spec-up-t 0.11.9 → 0.11.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,7 +50,7 @@ window.FontAwesomeKitConfig={asyncLoading:{enabled:!0},autoA11y:{enabled:!0},bas
50
50
  * @license MIT
51
51
  * @since 2024-06-09
52
52
  */
53
- function editTermButtons(){const t=document.querySelector("#terms-definitions ~ dl");const e=((s=specConfig.spec_directory).startsWith("./")?s=s.substring(2):s.startsWith("/")&&(s=s.substring(1)),s.endsWith("/")&&(s=s.slice(0,-1)),s);var s;t.querySelectorAll("dt").forEach(t=>{const s=t.querySelector("span").getAttribute("id").split(":")[1];t.innerHTML+=`<sup class="edit-term-button-sup"><a target="_blank" rel="noopener" href="https://github.com/${specConfig.source.account}/ctwg-main-glossary/blob/main/${e}/${specConfig.spec_terms_directory}/${s}.md" class="edit-term-button">Edit</a></sup><sup class="history-term-button-sup"><a target="_blank" rel="noopener" href="https://github.com/${specConfig.source.account}/ctwg-main-glossary/commits/main/${e}/${specConfig.spec_terms_directory}/${s}.md" class="history-term-button">History</a></sup>`})}document.addEventListener("DOMContentLoaded",(function(){editTermButtons()}));
53
+ function editTermButtons(){const t=document.querySelector(".terms-and-definitions-list");const e=((s=specConfig.spec_directory).startsWith("./")?s=s.substring(2):s.startsWith("/")&&(s=s.substring(1)),s.endsWith("/")&&(s=s.slice(0,-1)),s);var s;t.querySelectorAll("dt").forEach(t=>{const s=t.querySelector("span").getAttribute("id").split(":")[1];t.innerHTML+=`<sup class="edit-term-button-sup"><a target="_blank" rel="noopener" href="https://github.com/${specConfig.source.account}/ctwg-main-glossary/blob/main/${e}/${specConfig.spec_terms_directory}/${s}.md" class="edit-term-button">Edit</a></sup><sup class="history-term-button-sup"><a target="_blank" rel="noopener" href="https://github.com/${specConfig.source.account}/ctwg-main-glossary/commits/main/${e}/${specConfig.spec_terms_directory}/${s}.md" class="history-term-button">History</a></sup>`})}document.addEventListener("DOMContentLoaded",(function(){editTermButtons()}));
54
54
  function inPageSearch(){const e=document.querySelector("span[issue-count]"),t=specConfig.searchHighlightStyle||"ssi",n="search-h7vc6omi2hr2880",i=document.querySelector("main article");let c=document.createElement("div");c.setAttribute("id","container-"+n),c.setAttribute("class","container-"+n),e.after(c);let o=document.createElement("input");o.setAttribute("type","text"),o.setAttribute("id",n),o.setAttribute("placeholder","🔍"),c.appendChild(o),setTimeout(()=>{o.focus()},1e3);const r=document.createElement("div");r.setAttribute("id","back-and-forth-buttons-container-"+n);const a=document.createElement("button");a.setAttribute("id","one-match-backward-"+n),a.setAttribute("disabled","disabled"),a.setAttribute("title","Go to previous match. Shortcut key: Left Arrow"),a.textContent="▲",r.appendChild(a);const s=document.createElement("button");s.setAttribute("id","one-match-forward-"+n),s.setAttribute("disabled","disabled"),s.setAttribute("title","Go to next match. Shortcut key: Right Arrow"),s.textContent="▼",r.appendChild(s),c.appendChild(r);const d=document.createElement("span");d.setAttribute("id","total-matches-"+n),d.innerHTML="0 matches",c.appendChild(d),o.addEventListener("input",(function(){f(o.value)}));const h="highlight-matches-"+n,l={dif:"highlight-matches-DIF-search-h7vc6omi2hr2880",toip:"highlight-matches-ToIP-search-h7vc6omi2hr2880",btc:"highlight-matches-BTC-search-h7vc6omi2hr2880",keri:"highlight-matches-KERI-search-h7vc6omi2hr2880",ssi:"highlight-matches-SSI-search-h7vc6omi2hr2880",gleif:"highlight-matches-GLEIF-search-h7vc6omi2hr2880"}[t.toLowerCase()];let u=0,m=-1;function b(e){e.scrollIntoView({behavior:"smooth",block:"start"});const t=e.getBoundingClientRect(),n=t.top+window.pageYOffset-(window.innerHeight-t.height)/2;window.scrollTo({top:n,behavior:"smooth"})}function p(){m<=0?document.getElementById("one-match-backward-"+n).setAttribute("disabled","disabled"):document.getElementById("one-match-backward-"+n).removeAttribute("disabled"),m>=u-1?document.getElementById("one-match-forward-"+n).setAttribute("disabled","disabled"):document.getElementById("one-match-forward-"+n).removeAttribute("disabled")}function g(){d.innerHTML=u+" matches"}const f=function(e,t){let n;return function(){const i=this,c=arguments;clearTimeout(n),n=setTimeout(()=>e.apply(i,c),t)}}((function(e){if(function(){document.querySelectorAll("span."+h).forEach(e=>{Array.from(e.childNodes).forEach(t=>{t.nodeType===Node.ELEMENT_NODE&&e.removeChild(t)}),e.classList.contains(h)&&(e.outerHTML=e.innerHTML)})}(),u=0,m=-1,""===e)return void g();let t=0;!function i(c){if(3===c.nodeType){const i=function(i){const c=i.nodeValue,o=new RegExp(e,"gi");let r,a=0,s=document.createDocumentFragment();for(;null!==(r=o.exec(c));){s.appendChild(document.createTextNode(c.substring(a,r.index)));const e=document.createElement("span");e.textContent=r[0],e.classList.add(h),e.classList.add(l),e.setAttribute("id",n+"-"+t),s.appendChild(e),u=t+1,t++,a=r.index+r[0].length}return s.appendChild(document.createTextNode(c.substring(a))),s}(c);i.childNodes.length>1&&c.parentNode.replaceChild(i,c)}else 1===c.nodeType&&Array.from(c.childNodes).forEach(i)}(i);let c=document.querySelector("."+l);null!==c&&b(c);g(),p(),m=-1}),600);a.addEventListener("click",(function(){m--;const e=document.querySelector("#"+n+"-"+m);e&&b(e),e.classList.add("active"),setTimeout(()=>{e.classList.remove("active")},3e3),p()})),s.addEventListener("click",(function(){m++;const e=document.querySelector("#"+n+"-"+m);e&&b(e),e.classList.add("active"),setTimeout(()=>{e.classList.remove("active")},3e3),p()})),document.addEventListener("keyup",e=>{switch(e.key){case"ArrowRight":s.click();break;case"ArrowLeft":a.click()}})}document.addEventListener("DOMContentLoaded",(function(){inPageSearch()}));
55
55
  function highlightMenuItems(){let t=null;function e(t){document.querySelectorAll("#toc_list a").forEach(t=>{t.classList.remove("highlight-cfib41dyhcd99sm")});const e=document.querySelector(`#toc_list a[href="#${t.id}"]`);e&&(e.classList.add("highlight-cfib41dyhcd99sm"),e.scrollIntoView({behavior:"smooth",block:"center"}))}const o=new IntersectionObserver((o,n)=>{const c=o.filter(t=>t.isIntersecting).map(t=>t.target);c.length>0?(t=c[0],e(t)):t&&e(t)},{root:null,rootMargin:"0px",threshold:.1});document.querySelectorAll("h2, h3, h4, h5, h6").forEach(t=>o.observe(t))}document.addEventListener("DOMContentLoaded",(function(){highlightMenuItems()}));
56
56
  function backToTop(){const n=document.createElement("a");n.id="back-to-top-a1zncgtqfpzsig8",n.href="#content",n.innerHTML="↑",document.body.appendChild(n);const t=function(n,t){let e;return function(){const o=this,c=arguments;clearTimeout(e),e=setTimeout(()=>n.apply(o,c),t)}}((function(){window.scrollY>300?n.style.display="flex":n.style.display="none"}),600);window.addEventListener("scroll",(function(){t()}))}document.addEventListener("DOMContentLoaded",(function(){backToTop()}));
@@ -8,7 +8,7 @@
8
8
 
9
9
  function editTermButtons() {
10
10
  // find the definition list that is the next sibling of #terms-definitions
11
- const termsDefinitions = document.querySelector('#terms-definitions ~ dl');
11
+ const termsDefinitions = document.querySelector('.terms-and-definitions-list');
12
12
 
13
13
  // Remove "./" or "/" from the beginning of a string and "/" at the end of the string
14
14
  function cleanPath(path) {
package/index.js CHANGED
@@ -203,6 +203,31 @@ module.exports = function(options = {}) {
203
203
  anchorClassName: 'toc-anchor'
204
204
  })
205
205
  .use(require('@traptitech/markdown-it-katex'))
206
+
207
+ // Custom plugin to add class to <dl>
208
+ function addClassToDefinitionList(md) {
209
+ const originalRender = md.renderer.rules.dl_open || function (tokens, idx, options, env, self) {
210
+ return self.renderToken(tokens, idx, options);
211
+ };
212
+
213
+ md.renderer.rules.dl_open = function (tokens, idx, options, env, self) {
214
+ tokens[idx].attrPush(['class', 'terms-and-definitions-list']);
215
+ return originalRender(tokens, idx, options, env, self);
216
+ };
217
+ }
218
+
219
+ md.use(addClassToDefinitionList);
220
+
221
+ // Example markdown to test the functionality
222
+ const markdown = `
223
+ Term 1
224
+ : Definition 1
225
+
226
+ Term 2
227
+ : Definition 2
228
+ `;
229
+
230
+ console.log(md.render(markdown));
206
231
 
207
232
  async function render(spec, assets) {
208
233
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-up-t",
3
- "version": "0.11.9",
3
+ "version": "0.11.11",
4
4
  "description": "Technical specification drafting tool that generates rich specification documents from markdown. Forked from https://github.com/decentralized-identity/spec-up by Daniel Buchner (https://github.com/csuwildcat)",
5
5
  "main": "./index",
6
6
  "repository": {