marked-alert
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -0,1 +1,8 @@ | ||
## marked-alert [1.2.1](https://github.com/bent10/marked-extensions/compare/marked-alert@1.2.0...marked-alert@1.2.1) (2023-11-15) | ||
### Bug Fixes | ||
* resolves first-line tokens ([05a74cd](https://github.com/bent10/marked-extensions/commit/05a74cde1b082599e64fe6cdcd7f666a95b38cc2)) | ||
# marked-alert [1.2.0](https://github.com/bent10/marked-extensions/compare/marked-alert@1.1.2...marked-alert@1.2.0) (2023-11-07) | ||
@@ -2,0 +9,0 @@ |
@@ -1,2 +0,2 @@ | ||
const m = [ | ||
const p = [ | ||
{ | ||
@@ -20,7 +20,7 @@ type: "note", | ||
return e.length ? Object.values( | ||
[...m, ...e].reduce( | ||
[...p, ...e].reduce( | ||
(a, s) => (a[s.type] = s, a), | ||
{} | ||
) | ||
) : m; | ||
) : p; | ||
} | ||
@@ -43,3 +43,3 @@ function C(e, a) { | ||
walkTokens(t) { | ||
var n, l, c; | ||
var n, o, c; | ||
if (t.type !== "blockquote") | ||
@@ -56,13 +56,9 @@ return; | ||
titleClassName: g | ||
} = r, o = (n = t.tokens) == null ? void 0 : n[0], h = (l = o.raw) == null ? void 0 : l.replace( | ||
} = r, l = (n = t.tokens) == null ? void 0 : n[0], h = (o = l.raw) == null ? void 0 : o.replace( | ||
new RegExp(u(i)), | ||
"" | ||
), p = C(i, g); | ||
o.tokens = [ | ||
{ | ||
type: "text", | ||
raw: o.raw, | ||
text: `<span class="${p}">${v + d}</span>${h ? `<br />${h}` : ""}` | ||
} | ||
], Object.assign(t, { | ||
), m = C(i, g); | ||
l.tokens = this.Lexer.lexInline( | ||
`<span class="${m}">${v + d}</span>${h ? `<br />${h}` : ""}` | ||
), Object.assign(t, { | ||
type: "alert", | ||
@@ -74,5 +70,5 @@ meta: { | ||
title: d, | ||
titleClassName: p | ||
titleClassName: m | ||
} | ||
}), (c = t.tokens) == null || c.splice(0, 1, o); | ||
}), (c = t.tokens) == null || c.splice(0, 1, l); | ||
} | ||
@@ -79,0 +75,0 @@ }, |
@@ -1,4 +0,4 @@ | ||
(function(a,r){typeof exports=="object"&&typeof module<"u"?module.exports=r():typeof define=="function"&&define.amd?define(r):(a=typeof globalThis<"u"?globalThis:a||self,a.markedAlert=r())})(this,function(){"use strict";const a=[{type:"note",icon:'<svg class="octicon octicon-info mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>',titleClassName:"color-fg-accent text-semibold d-inline-flex flex-items-center mb-1"},{type:"important",icon:'<svg class="octicon octicon-report mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>',titleClassName:"color-fg-done text-semibold d-inline-flex flex-items-center mb-1"},{type:"warning",icon:'<svg class="octicon octicon-alert mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>',titleClassName:"color-fg-attention text-semibold d-inline-flex flex-items-center mb-1"}];function r(e){return e.length?Object.values([...a,...e].reduce((n,o)=>(n[o.type]=o,n),{})):a}function g(e,n){return n?["note","important","warning"].includes(e)?`${n}`:n:`text-${e}`}function d(e){return`^(?:\\[\\!${e.toUpperCase()}\\]|[\\*]{2}${p(e)}[\\*]{2})[s]*? | ||
?`}function p(e){return e.slice(0,1).toUpperCase()+e.slice(1).toLowerCase()}function w(e={}){const{className:n="markdown-alert",variants:o=[]}=e,b=r(o);return{walkTokens(t){var i,f,h;if(t.type!=="blockquote")return;const l=b.find(({type:s})=>new RegExp(d(s)).test(t.text));if(l){const{type:s,icon:m,title:u=p(s),titleClassName:C}=l,c=(i=t.tokens)==null?void 0:i[0],v=(f=c.raw)==null?void 0:f.replace(new RegExp(d(s)),""),x=g(s,C);c.tokens=[{type:"text",raw:c.raw,text:`<span class="${x}">${m+u}</span>${v?`<br />${v}`:""}`}],Object.assign(t,{type:"alert",meta:{className:n,variant:s,icon:m,title:u,titleClassName:x}}),(h=t.tokens)==null||h.splice(0,1,c)}},extensions:[{name:"alert",level:"block",renderer({meta:t,tokens:l=[]}){let i=`<div class="${t.className} ${t.className}-${t.variant}"> | ||
`;return i+=this.parser.parse(l),i+=`</div> | ||
`,i}}]}}return w}); | ||
(function(i,r){typeof exports=="object"&&typeof module<"u"?module.exports=r():typeof define=="function"&&define.amd?define(r):(i=typeof globalThis<"u"?globalThis:i||self,i.markedAlert=r())})(this,function(){"use strict";const i=[{type:"note",icon:'<svg class="octicon octicon-info mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>',titleClassName:"color-fg-accent text-semibold d-inline-flex flex-items-center mb-1"},{type:"important",icon:'<svg class="octicon octicon-report mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>',titleClassName:"color-fg-done text-semibold d-inline-flex flex-items-center mb-1"},{type:"warning",icon:'<svg class="octicon octicon-alert mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>',titleClassName:"color-fg-attention text-semibold d-inline-flex flex-items-center mb-1"}];function r(e){return e.length?Object.values([...i,...e].reduce((n,o)=>(n[o.type]=o,n),{})):i}function g(e,n){return n?["note","important","warning"].includes(e)?`${n}`:n:`text-${e}`}function d(e){return`^(?:\\[\\!${e.toUpperCase()}\\]|[\\*]{2}${h(e)}[\\*]{2})[s]*? | ||
?`}function h(e){return e.slice(0,1).toUpperCase()+e.slice(1).toLowerCase()}function w(e={}){const{className:n="markdown-alert",variants:o=[]}=e,b=r(o);return{walkTokens(t){var a,f,p;if(t.type!=="blockquote")return;const l=b.find(({type:s})=>new RegExp(d(s)).test(t.text));if(l){const{type:s,icon:m,title:u=h(s),titleClassName:C}=l,c=(a=t.tokens)==null?void 0:a[0],v=(f=c.raw)==null?void 0:f.replace(new RegExp(d(s)),""),x=g(s,C);c.tokens=this.Lexer.lexInline(`<span class="${x}">${m+u}</span>${v?`<br />${v}`:""}`),Object.assign(t,{type:"alert",meta:{className:n,variant:s,icon:m,title:u,titleClassName:x}}),(p=t.tokens)==null||p.splice(0,1,c)}},extensions:[{name:"alert",level:"block",renderer({meta:t,tokens:l=[]}){let a=`<div class="${t.className} ${t.className}-${t.variant}"> | ||
`;return a+=this.parser.parse(l),a+=`</div> | ||
`,a}}]}}return w}); |
{ | ||
"name": "marked-alert", | ||
"description": "A marked extension to support GFM alert", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"publishConfig": { | ||
@@ -6,0 +6,0 @@ "access": "public" |
Sorry, the diff of this file is not supported yet
19761
174