Socket
Socket
Sign inDemoInstall

marked-footnote

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marked-footnote - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

7

changelog.md

@@ -0,1 +1,8 @@

## marked-footnote [1.1.2](https://github.com/bent10/marked-extensions/compare/marked-footnote@1.1.1...marked-footnote@1.1.2) (2023-11-03)
### Bug Fixes
* always begin with empty footnotes items ([94aa01a](https://github.com/bent10/marked-extensions/commit/94aa01a0a571d9f04900e06fb0fa2e2baf021337))
## marked-footnote [1.1.1](https://github.com/bent10/marked-extensions/compare/marked-footnote@1.1.0...marked-footnote@1.1.1) (2023-10-26)

@@ -2,0 +9,0 @@

60

dist/index.js
function k({
prefixId: t,
prefixId: o,
lexer: s,
description: o
description: n
}) {
const n = {
const t = {
type: "footnotes",
raw: o,
raw: n,
items: []

@@ -16,3 +16,3 @@ };

tokenizer(e) {
s.hasFootnotes || (this.lexer.tokens.push(n), s.tokens = this.lexer.tokens, s.hasFootnotes = !0);
s.hasFootnotes || (this.lexer.tokens.push(t), s.tokens = this.lexer.tokens, s.hasFootnotes = !0, t.items = []);
const r = /^\[\^([^\]\n]+)\]:(?:[ \t]+|[\n]*?|$)([^\[\n]*?(?:\n|$)(?:[\n]*?[ ]{4,}[^\[\n]*)*)/.exec(

@@ -33,5 +33,5 @@ e

` : "", f += `<a href="#${t}ref-${encodeURIComponent(
` : "", f += `<a href="#${o}ref-${encodeURIComponent(
a
)}" data-${t}backref aria-label="Back to reference ${a}">↩</a>`;
)}" data-${o}backref aria-label="Back to reference ${a}">↩</a>`;
const u = {

@@ -43,3 +43,3 @@ type: "footnote",

};
return n.items.push(u), u;
return t.items.push(u), u;
}

@@ -52,10 +52,10 @@ },

}
function $(t, s = !1) {
function $(o, s = !1) {
return {
name: "footnoteRef",
level: "inline",
tokenizer(o) {
const n = /^\[\^([^\]\n]+)\]/.exec(o);
if (n) {
const [e, r] = n;
tokenizer(n) {
const t = /^\[\^([^\]\n]+)\]/.exec(n);
if (t) {
const [e, r] = t;
return {

@@ -68,16 +68,16 @@ type: "footnoteRef",

},
renderer({ label: o }) {
const n = encodeURIComponent(o);
return `<sup><a id="${t}ref-${n}" href="#${t + n}" data-${t}ref aria-describedby="${t}label">${s ? `[${o}]` : o}</a></sup>`;
renderer({ label: n }) {
const t = encodeURIComponent(n);
return `<sup><a id="${o}ref-${t}" href="#${o + t}" data-${o}ref aria-describedby="${o}label">${s ? `[${n}]` : n}</a></sup>`;
}
};
}
function p(t) {
function p(o) {
return {
name: "footnotes",
renderer({ raw: s, items: o = [] }) {
if (o.length === 0)
renderer({ raw: s, items: n = [] }) {
if (n.length === 0)
return "";
const n = o.reduce((r, { label: i, content: a }) => {
let c = `<li id="${t + encodeURIComponent(i)}">
const t = n.reduce((r, { label: i, content: a }) => {
let c = `<li id="${o + encodeURIComponent(i)}">
`;

@@ -89,5 +89,5 @@ return c += this.parser.parse(a), c += `</li>

`;
return e += `<h2 id="${t}label" class="sr-only">${s.trimEnd()}</h2>
return e += `<h2 id="${o}label" class="sr-only">${s.trimEnd()}</h2>
`, e += `<ol>
${n}
${t}
</ol>

@@ -99,16 +99,16 @@ `, e += `</section>

}
function m(t = {}) {
function m(o = {}) {
const {
prefixId: s = "footnote-",
description: o = "Footnotes",
refMarkers: n
} = t, e = { hasFootnotes: !1, tokens: [] };
description: n = "Footnotes",
refMarkers: t
} = o, e = { hasFootnotes: !1, tokens: [] };
return {
extensions: [
k({ prefixId: s, lexer: e, description: o }),
$(s, n),
k({ prefixId: s, lexer: e, description: n }),
$(s, t),
p(s)
],
walkTokens(r) {
e.tokens.indexOf(r) === 0 && r.type === "footnotes" && e.tokens.push(e.tokens.shift());
e.tokens.indexOf(r) === 0 && r.type === "footnotes" && (e.tokens.push(e.tokens.shift()), e.hasFootnotes = !1);
}

@@ -115,0 +115,0 @@ };

@@ -1,14 +0,14 @@

(function(c,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(c=typeof globalThis<"u"?globalThis:c||self,c.markedFootnote=i())})(this,function(){"use strict";function c({prefixId:t,lexer:s,description:n}){const o={type:"footnotes",raw:n,items:[]};return{name:"footnote",level:"block",childTokens:["content"],tokenizer(e){s.hasFootnotes||(this.lexer.tokens.push(o),s.tokens=this.lexer.tokens,s.hasFootnotes=!0);const r=/^\[\^([^\]\n]+)\]:(?:[ \t]+|[\n]*?|$)([^\[\n]*?(?:\n|$)(?:[\n]*?[ ]{4,}[^\[\n]*)*)/.exec(e);if(r){const[u,a,f=""]=r;let l=f.split(`
`).reduce(($,m)=>$+`
`+m.replace(/^(?:[ ]{4}|[\t])/,""),"");const d=l.trimEnd().split(`
(function(c,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(c=typeof globalThis<"u"?globalThis:c||self,c.markedFootnote=i())})(this,function(){"use strict";function c({prefixId:n,lexer:s,description:o}){const t={type:"footnotes",raw:o,items:[]};return{name:"footnote",level:"block",childTokens:["content"],tokenizer(e){s.hasFootnotes||(this.lexer.tokens.push(t),s.tokens=this.lexer.tokens,s.hasFootnotes=!0,t.items=[]);const r=/^\[\^([^\]\n]+)\]:(?:[ \t]+|[\n]*?|$)([^\[\n]*?(?:\n|$)(?:[\n]*?[ ]{4,}[^\[\n]*)*)/.exec(e);if(r){const[u,a,f=""]=r;let l=f.split(`
`).reduce((m,$)=>m+`
`+$.replace(/^(?:[ ]{4}|[\t])/,""),"");const d=l.trimEnd().split(`
`).pop();l+=d&&/^[ \t]*?[>\-\*][ ]|[`]{3,}$|^[ \t]*?[\|].+[\|]$/.test(d)?`
`:"",l+=`<a href="#${t}ref-${encodeURIComponent(a)}" data-${t}backref aria-label="Back to reference ${a}">↩</a>`;const h={type:"footnote",raw:u,label:a,content:this.lexer.blockTokens(l)};return o.items.push(h),h}},renderer(){return""}}}function i(t,s=!1){return{name:"footnoteRef",level:"inline",tokenizer(n){const o=/^\[\^([^\]\n]+)\]/.exec(n);if(o){const[e,r]=o;return{type:"footnoteRef",raw:e,label:r}}},renderer({label:n}){const o=encodeURIComponent(n);return`<sup><a id="${t}ref-${o}" href="#${t+o}" data-${t}ref aria-describedby="${t}label">${s?`[${n}]`:n}</a></sup>`}}}function p(t){return{name:"footnotes",renderer({raw:s,items:n=[]}){if(n.length===0)return"";const o=n.reduce((r,{label:u,content:a})=>{let f=`<li id="${t+encodeURIComponent(u)}">
`:"",l+=`<a href="#${n}ref-${encodeURIComponent(a)}" data-${n}backref aria-label="Back to reference ${a}">↩</a>`;const h={type:"footnote",raw:u,label:a,content:this.lexer.blockTokens(l)};return t.items.push(h),h}},renderer(){return""}}}function i(n,s=!1){return{name:"footnoteRef",level:"inline",tokenizer(o){const t=/^\[\^([^\]\n]+)\]/.exec(o);if(t){const[e,r]=t;return{type:"footnoteRef",raw:e,label:r}}},renderer({label:o}){const t=encodeURIComponent(o);return`<sup><a id="${n}ref-${t}" href="#${n+t}" data-${n}ref aria-describedby="${n}label">${s?`[${o}]`:o}</a></sup>`}}}function p(n){return{name:"footnotes",renderer({raw:s,items:o=[]}){if(o.length===0)return"";const t=o.reduce((r,{label:u,content:a})=>{let f=`<li id="${n+encodeURIComponent(u)}">
`;return f+=this.parser.parse(a),f+=`</li>
`,r+f},"");let e=`<section class="footnotes" data-footnotes>
`;return e+=`<h2 id="${t}label" class="sr-only">${s.trimEnd()}</h2>
`;return e+=`<h2 id="${n}label" class="sr-only">${s.trimEnd()}</h2>
`,e+=`<ol>
${o}
${t}
</ol>
`,e+=`</section>
`,e}}}function k(t={}){const{prefixId:s="footnote-",description:n="Footnotes",refMarkers:o}=t,e={hasFootnotes:!1,tokens:[]};return{extensions:[c({prefixId:s,lexer:e,description:n}),i(s,o),p(s)],walkTokens(r){e.tokens.indexOf(r)===0&&r.type==="footnotes"&&e.tokens.push(e.tokens.shift())}}}return k});
`,e}}}function k(n={}){const{prefixId:s="footnote-",description:o="Footnotes",refMarkers:t}=n,e={hasFootnotes:!1,tokens:[]};return{extensions:[c({prefixId:s,lexer:e,description:o}),i(s,t),p(s)],walkTokens(r){e.tokens.indexOf(r)===0&&r.type==="footnotes"&&(e.tokens.push(e.tokens.shift()),e.hasFootnotes=!1)}}}return k});
{
"name": "marked-footnote",
"description": "A marked extension to support GFM footnotes",
"version": "1.1.1",
"version": "1.1.2",
"publishConfig": {

@@ -6,0 +6,0 @@ "access": "public"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc