@hackersheet/react-document-content 0.1.0-alpha.1 → 0.1.0-alpha.2

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.
@@ -0,0 +1 @@
1
+ import{isUrl as e}from"./chunk-RJXUMWGD.mjs";import t from"path";import r from"mustache";import{visit as i}from"unist-util-visit";function o({document:o,permaLinkFormat:p}){return s=>{i(s,"element",(i=>{const s=i.properties.href||i.properties.src,n=i.tagName;if(!s||"string"!=typeof s||e(s)||!o.path)return;const m=`/${t.dirname(o.path)}`,a=t.resolve(m,decodeURI(s)).replace(/^\//,"");if("a"===n){const e=o.outboundLinkDocuments.find((e=>e.path===a));e&&(i.properties.href=r.render(p,e))}if("img"===n){const e=o.assets.find((e=>e.path===a));e&&(i.properties.src=e.fileUrl,i.properties.height=e.height,i.properties.width=e.width,i.properties.alt=i.properties.alt||e.name)}}))}}export{o as processInternalLinks};
@@ -0,0 +1 @@
1
+ import{CodeBlock as m}from"./chunk-SZ4JBPX3.mjs";import{Image as o}from"./chunk-V3EETEZ2.mjs";import{Link as r}from"./chunk-VAJW32XH.mjs";import{KifuTo as t}from"./chunk-KWMHEAK7.mjs";import{LinkCard as e}from"./chunk-DMHUI7N4.mjs";import{XPost as n}from"./chunk-PRANC7GD.mjs";import{Youtube as i}from"./chunk-4AECATS3.mjs";import{processInternalLinks as p}from"./chunk-5SIG5F5U.mjs";import{rehypeClobberUrlDecode as c}from"./chunk-GBGPKOHZ.mjs";import{rehypeFootnoteLinks as u}from"./chunk-WCR2TQ7A.mjs";import{XPostComponentResolver as k}from"./chunk-3T5XKKF2.mjs";import{YoutubeComponentResolver as s}from"./chunk-BKU6TR65.mjs";import{AComponentResolver as a}from"./chunk-KBFID3JF.mjs";import{ImgComponentResolver as f}from"./chunk-LSMKHHUW.mjs";import{KifuToComponentResolver as h}from"./chunk-WONBYQ3V.mjs";import{LinkCardComponentResolver as d}from"./chunk-KHY6ACRD.mjs";import{PreComponentResolver as j}from"./chunk-SPGHZ4ZA.mjs";import l from"deepmerge";import C from"react";import y from"react-markdown";import g from"rehype-katex";import K from"rehype-raw";import P,{defaultSchema as b}from"rehype-sanitize";import A from"rehype-slug";import H from"remark-directive";import T from"remark-directive-rehype";import B from"remark-gfm";import N from"remark-math";function x({document:x,permaLinkFormat:E,style:F,components:L}){const G=l(b,{attributes:{div:[["className",/^sr-only$/]]},tagNames:["link-card","x-post","youtube","kifu-to"]}),R=L?.codeBlock??m,S=L?.image??o,W=L?.kifuTo??t,Z=L?.linkCard??e,v=L?.link??r,D=L?.xPost??n,I=L?.youtube??i,U={remarkRehypeOptions:{footnoteLabelTagName:"div",clobberPrefix:""},remarkPlugins:[B,N,H,T],rehypePlugins:[K,[P,G],A,g,[p,{document:x,permaLinkFormat:E}],u,c],components:{"kifu-to":m=>h({...m,document:x,KifuToComponent:W}),"link-card":m=>d({...m,document:x,LinkCardComponent:Z}),"x-post":m=>k({...m,document:x,XPostComponent:D}),a:m=>a({...m,document:x,LinkComponent:v}),h1:"h2",img:m=>f({...m,document:x,ImageComponent:S}),pre:m=>j({...m,document:x,CodeBlockComponent:R}),youtube:m=>s({...m,document:x,YoutubeComponent:I})}};return C.createElement(y,{className:F&&F.main,...U},x.content)}export{x as DocumentContent};
@@ -1 +1 @@
1
- import"../chunk-FLTUTZXL.mjs";import{CodeBlock as m}from"../chunk-SZ4JBPX3.mjs";import{LinkCard as o}from"../chunk-DMHUI7N4.mjs";import{KifuTo as r}from"../chunk-KWMHEAK7.mjs";import{Link as p}from"../chunk-VAJW32XH.mjs";import{Image as t}from"../chunk-V3EETEZ2.mjs";import{XPost as c}from"../chunk-PRANC7GD.mjs";import{Youtube as h}from"../chunk-4AECATS3.mjs";export{m as CodeBlock,t as Image,r as KifuTo,p as Link,o as LinkCard,c as XPost,h as Youtube};
1
+ import"../chunk-FLTUTZXL.mjs";import{CodeBlock as m}from"../chunk-SZ4JBPX3.mjs";import{Image as o}from"../chunk-V3EETEZ2.mjs";import{Link as r}from"../chunk-VAJW32XH.mjs";import{KifuTo as p}from"../chunk-KWMHEAK7.mjs";import{LinkCard as t}from"../chunk-DMHUI7N4.mjs";import{XPost as c}from"../chunk-PRANC7GD.mjs";import{Youtube as h}from"../chunk-4AECATS3.mjs";export{m as CodeBlock,o as Image,p as KifuTo,r as Link,t as LinkCard,c as XPost,h as Youtube};
@@ -1 +1 @@
1
- "use strict";var e,t=Object.create,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,u=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,u,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of i(t))a.call(e,l)||l===u||r(e,l,{get:()=>t[l],enumerable:!(o=n(t,l))||o.enumerable});return e},l=(e,n,i)=>(i=null!=e?t(u(e)):{},o(!n&&e&&e.__esModule?i:r(i,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})(c,{DocumentContent:()=>V}),module.exports=(e=c,o(r({},"__esModule",{value:!0}),e));var d=l(require("deepmerge")),f=l(require("react")),s=l(require("react-markdown")),m=l(require("rehype-katex")),p=l(require("rehype-raw")),h=l(require("rehype-sanitize")),g=l(require("rehype-slug")),v=l(require("remark-directive")),b=l(require("remark-directive-rehype")),y=l(require("remark-gfm")),q=l(require("remark-math")),E=l(require("react"));var k=l(require("react"));var w=l(require("react"));var C=l(require("react"));var x=l(require("react"));var P=l(require("react"));function I({children:e,node:t,XPostComponent:r}){if(!t)return P.default.createElement("p",null,e);const n=t.children[0].properties?.href;if(!n||"string"!=typeof n)return P.default.createElement("p",null,e);const i=function(e){try{const t=new URL(e);if(/(^|\.)(twitter|x).com$/.test(t.host))return t.pathname.match(/\/status(es)?\/(\d+)/)?.[2]}catch{return}}(n);return i?P.default.createElement(r,{id:i,children:e}):P.default.createElement("p",null,e)}var L=l(require("react"));function N({children:e,node:t,YoutubeComponent:r}){const n=L.default.createElement("p",null,e);if(!t)return n;const i=t.children[0].properties?.href;if(!i||"string"!=typeof i)return n;const u=function(e){const t=/^https?:\/\/(www\.)?youtube\.com\/watch\?(.*&)?v=(?<videoId>[^&]+)/.exec(e)??/^https?:\/\/youtu\.be\/(?<videoId>[^?]+)/.exec(e)??/^https?:\/\/(www\.)?youtube\.com\/embed\/(?<videoId>[^?]+)/.exec(e);if(t?.groups?.videoId)return t.groups.videoId;return null}(i);if(!u)return n;const a=function(e){try{const t=new URL(e).searchParams.get("t");if(!t)return;return Number(t.endsWith("s")?t.slice(0,-1):t)}catch{return}}(i);return L.default.createElement(r,{videoId:u,params:{start:a},children:e})}var O=l(require("react"));function F(e){return O.default.createElement("div",null,O.default.createElement("pre",null,e.code))}var U=l(require("react"));function $({src:e,width:t,height:r,alt:n}){return U.default.createElement("img",{src:e,width:t,height:r,alt:n})}var j=l(require("react"));function R({id:e,ply:t,label:r}){const n=`?ply=${t}#${`user-content-${e}`}`,i=r??`${t}手目`;return j.default.createElement("a",{href:n},i)}var T=l(require("react"));function W({href:e,id:t,children:r}){return T.default.createElement("a",{href:e,id:t},r)}var D=l(require("react"));function _({url:e,title:t}){return D.default.createElement("p",null,D.default.createElement("a",{href:e},t))}var B=l(require("react"));function K({children:e}){return B.default.createElement(B.default.Fragment,null,e)}var M=l(require("react"));function S({children:e}){return M.default.createElement(M.default.Fragment,null,e)}var X=l(require("path")),Y=l(require("mustache")),z=require("unist-util-visit");function H({document:e,permaLinkFormat:t}){return r=>{(0,z.visit)(r,"element",(r=>{const n=r.properties.href||r.properties.src,i=r.tagName;if(!n||"string"!=typeof n||function(e){try{return new URL(e),!0}catch(e){return!1}}(n)||!e.path)return;const u=`/${X.dirname(e.path)}`,a=X.resolve(u,decodeURI(n)).replace(/^\//,"");if("a"===i){const n=e.outboundLinkDocuments.find((e=>e.path===a));n&&(r.properties.href=Y.default.render(t,n))}if("img"===i){const t=e.assets.find((e=>e.path===a));t&&(r.properties.src=t.fileUrl,r.properties.height=t.height,r.properties.width=t.width,r.properties.alt=r.properties.alt||t.name)}}))}}var A=require("unist-util-visit");function G(e){return t=>{(0,A.visit)(t,"element",(t=>{const r=t.properties.id,n=e&&"string"==typeof e.clobberPrefix?e.clobberPrefix:"user-content-";"string"==typeof r&&r.startsWith(n)&&(t.properties.id=decodeURI(r))}))}}var J=require("unist-util-visit");function Q(e){return t=>{(0,J.visit)(t,"element",(t=>{const r=t.tagName,n=t.properties.href,i=e&&"string"==typeof e.clobberPrefix?e.clobberPrefix:"user-content-";"a"===r&&"string"==typeof n&&(n.startsWith("#fn-")||n.startsWith("#fnref-"))&&(t.properties.href=`#${i}`+n.replace("#",""))}))}}function V({document:e,permaLinkFormat:t,style:r,components:n}){const i=(0,d.default)(h.defaultSchema,{attributes:{div:[["className",/^sr-only$/]]},tagNames:["link-card","x-post","youtube","kifu-to"]}),u=n?.codeBlock??F,a=n?.image??$,o=n?.kifuTo??R,l=n?.linkCard??_,c=n?.link??W,P=n?.xPost??K,L=n?.youtube??S,O={remarkRehypeOptions:{footnoteLabelTagName:"div",clobberPrefix:""},remarkPlugins:[y.default,q.default,v.default,b.default],rehypePlugins:[p.default,[h.default,i],g.default,m.default,[H,{document:e,permaLinkFormat:t}],Q,G],components:{"kifu-to":t=>function({children:e,node:t,KifuToComponent:r}){const n=w.default.createElement(w.default.Fragment,null,e);if(!t)return n;if("string"!=typeof e)return n;const[i,u]=e.split(":"),a=t.properties.label?String(t.properties.label):void 0;return w.default.createElement(r,{id:i,ply:u,label:a,children:e})}({...t,document:e,KifuToComponent:o}),"link-card":t=>function({children:e,node:t,document:r,LinkCardComponent:n}){if(!t)return C.default.createElement("p",null,e);const i=t.children[0].properties?.href;if(!i)return C.default.createElement("p",null,e);const u=r.websites.find((e=>e.url===i));return u?C.default.createElement(n,{url:u.url,title:u.ogTitle||u.title||u.url,description:u.ogDescription||u.description,domain:u.domain,imageUrl:u.ogImage?.fileUrl??void 0,imageHeight:u.ogImage?.height,imageWidth:u.ogImage?.width,children:e}):C.default.createElement("p",null,e)}({...t,document:e,LinkCardComponent:l}),"x-post":t=>I({...t,document:e,XPostComponent:P}),a:t=>function({href:e,id:t,children:r,LinkComponent:n}){return e?E.default.createElement(n,{href:e,id:t,children:r}):E.default.createElement(E.default.Fragment,null,r)}({...t,document:e,LinkComponent:c}),h1:"h2",img:t=>function({children:e,src:t,width:r,height:n,alt:i,ImageComponent:u}){return t&&r&&n&&i?k.default.createElement(u,{src:t,width:Number(r),height:Number(n),alt:i,children:e}):k.default.createElement(k.default.Fragment,null,e)}({...t,document:e,ImageComponent:a}),pre:t=>function({children:e,node:t,document:r,CodeBlockComponent:n}){const i=x.default.createElement(x.default.Fragment,null,e);if(!t)return i;const u=t.children[0];if("element"!==u.type||"code"!==u.tagName)return i;const a=u.children[0];if("text"!==a.type)return i;const o=u.properties.className,l=a.value,c=/language-(.+)/.exec(o||""),d=c&&c[1]?c[1]:"";return x.default.createElement(n,{code:l,language:d,document:r,children:e})}({...t,document:e,CodeBlockComponent:u}),youtube:t=>N({...t,document:e,YoutubeComponent:L})}};return f.default.createElement(s.default,{className:r&&r.main,...O},e.content)}
1
+ "use strict";var e,t=Object.create,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,u=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,u,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of i(t))a.call(e,l)||l===u||r(e,l,{get:()=>t[l],enumerable:!(o=n(t,l))||o.enumerable});return e},l=(e,n,i)=>(i=null!=e?t(u(e)):{},o(!n&&e&&e.__esModule?i:r(i,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})(c,{DocumentContent:()=>V}),module.exports=(e=c,o(r({},"__esModule",{value:!0}),e));var d=l(require("deepmerge")),f=l(require("react")),s=l(require("react-markdown")),m=l(require("rehype-katex")),p=l(require("rehype-raw")),h=l(require("rehype-sanitize")),g=l(require("rehype-slug")),v=l(require("remark-directive")),b=l(require("remark-directive-rehype")),y=l(require("remark-gfm")),q=l(require("remark-math")),E=l(require("react"));var k=l(require("react"));var w=l(require("react"));var C=l(require("react"));var x=l(require("react"));var P=l(require("react"));function I({children:e,node:t,XPostComponent:r}){if(!t)return P.default.createElement("p",null,e);const n=t.children[0].properties?.href;if(!n||"string"!=typeof n)return P.default.createElement("p",null,e);const i=function(e){try{const t=new URL(e);if(/(^|\.)(twitter|x).com$/.test(t.host))return t.pathname.match(/\/status(es)?\/(\d+)/)?.[2]}catch{return}}(n);return i?P.default.createElement(r,{id:i,children:e}):P.default.createElement("p",null,e)}var L=l(require("react"));function N({children:e,node:t,YoutubeComponent:r}){const n=L.default.createElement("p",null,e);if(!t)return n;const i=t.children[0].properties?.href;if(!i||"string"!=typeof i)return n;const u=function(e){const t=/^https?:\/\/(www\.)?youtube\.com\/watch\?(.*&)?v=(?<videoId>[^&]+)/.exec(e)??/^https?:\/\/youtu\.be\/(?<videoId>[^?]+)/.exec(e)??/^https?:\/\/(www\.)?youtube\.com\/embed\/(?<videoId>[^?]+)/.exec(e);if(t?.groups?.videoId)return t.groups.videoId;return null}(i);if(!u)return n;const a=function(e){try{const t=new URL(e).searchParams.get("t");if(!t)return;return Number(t.endsWith("s")?t.slice(0,-1):t)}catch{return}}(i);return L.default.createElement(r,{videoId:u,params:{start:a},children:e})}var O=l(require("react"));function F(e){return O.default.createElement("div",null,O.default.createElement("pre",null,e.code))}var U=l(require("react"));function $({src:e,width:t,height:r,alt:n}){return U.default.createElement("img",{src:e,width:t,height:r,alt:n})}var j=l(require("react"));function R({id:e,ply:t,label:r}){const n=`?ply=${t}#${`user-content-${e}`}`,i=r??`${t}手目`;return j.default.createElement("a",{href:n},i)}var T=l(require("react"));function W({href:e,id:t,children:r}){return T.default.createElement("a",{href:e,id:t},r)}var D=l(require("react"));function _({url:e,title:t}){return D.default.createElement("p",null,D.default.createElement("a",{href:e},t))}var B=l(require("react"));function K({children:e}){return B.default.createElement(B.default.Fragment,null,e)}var M=l(require("react"));function S({children:e}){return M.default.createElement(M.default.Fragment,null,e)}var X=l(require("path")),Y=l(require("mustache")),z=require("unist-util-visit");function H({document:e,permaLinkFormat:t}){return r=>{(0,z.visit)(r,"element",(r=>{const n=r.properties.href||r.properties.src,i=r.tagName;if(!n||"string"!=typeof n||function(e){try{return new URL(e),!0}catch(e){return!1}}(n)||!e.path)return;const u=`/${X.default.dirname(e.path)}`,a=X.default.resolve(u,decodeURI(n)).replace(/^\//,"");if("a"===i){const n=e.outboundLinkDocuments.find((e=>e.path===a));n&&(r.properties.href=Y.default.render(t,n))}if("img"===i){const t=e.assets.find((e=>e.path===a));t&&(r.properties.src=t.fileUrl,r.properties.height=t.height,r.properties.width=t.width,r.properties.alt=r.properties.alt||t.name)}}))}}var A=require("unist-util-visit");function G(e){return t=>{(0,A.visit)(t,"element",(t=>{const r=t.properties.id,n=e&&"string"==typeof e.clobberPrefix?e.clobberPrefix:"user-content-";"string"==typeof r&&r.startsWith(n)&&(t.properties.id=decodeURI(r))}))}}var J=require("unist-util-visit");function Q(e){return t=>{(0,J.visit)(t,"element",(t=>{const r=t.tagName,n=t.properties.href,i=e&&"string"==typeof e.clobberPrefix?e.clobberPrefix:"user-content-";"a"===r&&"string"==typeof n&&(n.startsWith("#fn-")||n.startsWith("#fnref-"))&&(t.properties.href=`#${i}`+n.replace("#",""))}))}}function V({document:e,permaLinkFormat:t,style:r,components:n}){const i=(0,d.default)(h.defaultSchema,{attributes:{div:[["className",/^sr-only$/]]},tagNames:["link-card","x-post","youtube","kifu-to"]}),u=n?.codeBlock??F,a=n?.image??$,o=n?.kifuTo??R,l=n?.linkCard??_,c=n?.link??W,P=n?.xPost??K,L=n?.youtube??S,O={remarkRehypeOptions:{footnoteLabelTagName:"div",clobberPrefix:""},remarkPlugins:[y.default,q.default,v.default,b.default],rehypePlugins:[p.default,[h.default,i],g.default,m.default,[H,{document:e,permaLinkFormat:t}],Q,G],components:{"kifu-to":t=>function({children:e,node:t,KifuToComponent:r}){const n=w.default.createElement(w.default.Fragment,null,e);if(!t)return n;if("string"!=typeof e)return n;const[i,u]=e.split(":"),a=t.properties.label?String(t.properties.label):void 0;return w.default.createElement(r,{id:i,ply:u,label:a,children:e})}({...t,document:e,KifuToComponent:o}),"link-card":t=>function({children:e,node:t,document:r,LinkCardComponent:n}){if(!t)return C.default.createElement("p",null,e);const i=t.children[0].properties?.href;if(!i)return C.default.createElement("p",null,e);const u=r.websites.find((e=>e.url===i));return u?C.default.createElement(n,{url:u.url,title:u.ogTitle||u.title||u.url,description:u.ogDescription||u.description,domain:u.domain,imageUrl:u.ogImage?.fileUrl??void 0,imageHeight:u.ogImage?.height,imageWidth:u.ogImage?.width,children:e}):C.default.createElement("p",null,e)}({...t,document:e,LinkCardComponent:l}),"x-post":t=>I({...t,document:e,XPostComponent:P}),a:t=>function({href:e,id:t,children:r,LinkComponent:n}){return e?E.default.createElement(n,{href:e,id:t,children:r}):E.default.createElement(E.default.Fragment,null,r)}({...t,document:e,LinkComponent:c}),h1:"h2",img:t=>function({children:e,src:t,width:r,height:n,alt:i,ImageComponent:u}){return t&&r&&n&&i?k.default.createElement(u,{src:t,width:Number(r),height:Number(n),alt:i,children:e}):k.default.createElement(k.default.Fragment,null,e)}({...t,document:e,ImageComponent:a}),pre:t=>function({children:e,node:t,document:r,CodeBlockComponent:n}){const i=x.default.createElement(x.default.Fragment,null,e);if(!t)return i;const u=t.children[0];if("element"!==u.type||"code"!==u.tagName)return i;const a=u.children[0];if("text"!==a.type)return i;const o=u.properties.className,l=a.value,c=/language-(.+)/.exec(o||""),d=c&&c[1]?c[1]:"";return x.default.createElement(n,{code:l,language:d,document:r,children:e})}({...t,document:e,CodeBlockComponent:u}),youtube:t=>N({...t,document:e,YoutubeComponent:L})}};return f.default.createElement(s.default,{className:r&&r.main,...O},e.content)}
@@ -1 +1 @@
1
- import{DocumentContent as m}from"./chunk-NCRMT2TF.mjs";import"./chunk-FLTUTZXL.mjs";import"./chunk-SZ4JBPX3.mjs";import"./chunk-DMHUI7N4.mjs";import"./chunk-KWMHEAK7.mjs";import"./chunk-VAJW32XH.mjs";import"./chunk-V3EETEZ2.mjs";import"./chunk-PRANC7GD.mjs";import"./chunk-4AECATS3.mjs";import"./chunk-O2ZRKYA4.mjs";import"./chunk-G64LX7GY.mjs";import"./chunk-GBGPKOHZ.mjs";import"./chunk-WCR2TQ7A.mjs";import"./chunk-X6VPHWKN.mjs";import"./chunk-RJXUMWGD.mjs";import"./chunk-PUVQXCMZ.mjs";import"./chunk-3T5XKKF2.mjs";import"./chunk-BKU6TR65.mjs";import"./chunk-KBFID3JF.mjs";import"./chunk-LSMKHHUW.mjs";import"./chunk-WONBYQ3V.mjs";import"./chunk-KHY6ACRD.mjs";import"./chunk-SPGHZ4ZA.mjs";export{m as DocumentContent};
1
+ import{DocumentContent as m}from"./chunk-QZS75SC2.mjs";import"./chunk-FLTUTZXL.mjs";import"./chunk-SZ4JBPX3.mjs";import"./chunk-V3EETEZ2.mjs";import"./chunk-VAJW32XH.mjs";import"./chunk-KWMHEAK7.mjs";import"./chunk-DMHUI7N4.mjs";import"./chunk-PRANC7GD.mjs";import"./chunk-4AECATS3.mjs";import"./chunk-O2ZRKYA4.mjs";import"./chunk-5SIG5F5U.mjs";import"./chunk-GBGPKOHZ.mjs";import"./chunk-WCR2TQ7A.mjs";import"./chunk-X6VPHWKN.mjs";import"./chunk-RJXUMWGD.mjs";import"./chunk-PUVQXCMZ.mjs";import"./chunk-3T5XKKF2.mjs";import"./chunk-BKU6TR65.mjs";import"./chunk-KBFID3JF.mjs";import"./chunk-LSMKHHUW.mjs";import"./chunk-WONBYQ3V.mjs";import"./chunk-KHY6ACRD.mjs";import"./chunk-SPGHZ4ZA.mjs";export{m as DocumentContent};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.create,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,u=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,u,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of i(t))a.call(e,l)||l===u||r(e,l,{get:()=>t[l],enumerable:!(o=n(t,l))||o.enumerable});return e},l=(e,n,i)=>(i=null!=e?t(u(e)):{},o(!n&&e&&e.__esModule?i:r(i,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})(c,{DocumentContent:()=>V}),module.exports=(e=c,o(r({},"__esModule",{value:!0}),e));var d=l(require("deepmerge")),f=l(require("react")),s=l(require("react-markdown")),m=l(require("rehype-katex")),p=l(require("rehype-raw")),h=l(require("rehype-sanitize")),g=l(require("rehype-slug")),v=l(require("remark-directive")),b=l(require("remark-directive-rehype")),y=l(require("remark-gfm")),q=l(require("remark-math")),E=l(require("react"));var k=l(require("react"));var w=l(require("react"));var C=l(require("react"));var x=l(require("react"));var P=l(require("react"));function I({children:e,node:t,XPostComponent:r}){if(!t)return P.default.createElement("p",null,e);const n=t.children[0].properties?.href;if(!n||"string"!=typeof n)return P.default.createElement("p",null,e);const i=function(e){try{const t=new URL(e);if(/(^|\.)(twitter|x).com$/.test(t.host))return t.pathname.match(/\/status(es)?\/(\d+)/)?.[2]}catch{return}}(n);return i?P.default.createElement(r,{id:i,children:e}):P.default.createElement("p",null,e)}var L=l(require("react"));function N({children:e,node:t,YoutubeComponent:r}){const n=L.default.createElement("p",null,e);if(!t)return n;const i=t.children[0].properties?.href;if(!i||"string"!=typeof i)return n;const u=function(e){const t=/^https?:\/\/(www\.)?youtube\.com\/watch\?(.*&)?v=(?<videoId>[^&]+)/.exec(e)??/^https?:\/\/youtu\.be\/(?<videoId>[^?]+)/.exec(e)??/^https?:\/\/(www\.)?youtube\.com\/embed\/(?<videoId>[^?]+)/.exec(e);if(t?.groups?.videoId)return t.groups.videoId;return null}(i);if(!u)return n;const a=function(e){try{const t=new URL(e).searchParams.get("t");if(!t)return;return Number(t.endsWith("s")?t.slice(0,-1):t)}catch{return}}(i);return L.default.createElement(r,{videoId:u,params:{start:a},children:e})}var O=l(require("react"));function F(e){return O.default.createElement("div",null,O.default.createElement("pre",null,e.code))}var U=l(require("react"));function $({src:e,width:t,height:r,alt:n}){return U.default.createElement("img",{src:e,width:t,height:r,alt:n})}var j=l(require("react"));function R({id:e,ply:t,label:r}){const n=`?ply=${t}#${`user-content-${e}`}`,i=r??`${t}手目`;return j.default.createElement("a",{href:n},i)}var T=l(require("react"));function W({href:e,id:t,children:r}){return T.default.createElement("a",{href:e,id:t},r)}var D=l(require("react"));function _({url:e,title:t}){return D.default.createElement("p",null,D.default.createElement("a",{href:e},t))}var B=l(require("react"));function K({children:e}){return B.default.createElement(B.default.Fragment,null,e)}var M=l(require("react"));function S({children:e}){return M.default.createElement(M.default.Fragment,null,e)}var X=l(require("path")),Y=l(require("mustache")),z=require("unist-util-visit");function H({document:e,permaLinkFormat:t}){return r=>{(0,z.visit)(r,"element",(r=>{const n=r.properties.href||r.properties.src,i=r.tagName;if(!n||"string"!=typeof n||function(e){try{return new URL(e),!0}catch(e){return!1}}(n)||!e.path)return;const u=`/${X.dirname(e.path)}`,a=X.resolve(u,decodeURI(n)).replace(/^\//,"");if("a"===i){const n=e.outboundLinkDocuments.find((e=>e.path===a));n&&(r.properties.href=Y.default.render(t,n))}if("img"===i){const t=e.assets.find((e=>e.path===a));t&&(r.properties.src=t.fileUrl,r.properties.height=t.height,r.properties.width=t.width,r.properties.alt=r.properties.alt||t.name)}}))}}var A=require("unist-util-visit");function G(e){return t=>{(0,A.visit)(t,"element",(t=>{const r=t.properties.id,n=e&&"string"==typeof e.clobberPrefix?e.clobberPrefix:"user-content-";"string"==typeof r&&r.startsWith(n)&&(t.properties.id=decodeURI(r))}))}}var J=require("unist-util-visit");function Q(e){return t=>{(0,J.visit)(t,"element",(t=>{const r=t.tagName,n=t.properties.href,i=e&&"string"==typeof e.clobberPrefix?e.clobberPrefix:"user-content-";"a"===r&&"string"==typeof n&&(n.startsWith("#fn-")||n.startsWith("#fnref-"))&&(t.properties.href=`#${i}`+n.replace("#",""))}))}}function V({document:e,permaLinkFormat:t,style:r,components:n}){const i=(0,d.default)(h.defaultSchema,{attributes:{div:[["className",/^sr-only$/]]},tagNames:["link-card","x-post","youtube","kifu-to"]}),u=n?.codeBlock??F,a=n?.image??$,o=n?.kifuTo??R,l=n?.linkCard??_,c=n?.link??W,P=n?.xPost??K,L=n?.youtube??S,O={remarkRehypeOptions:{footnoteLabelTagName:"div",clobberPrefix:""},remarkPlugins:[y.default,q.default,v.default,b.default],rehypePlugins:[p.default,[h.default,i],g.default,m.default,[H,{document:e,permaLinkFormat:t}],Q,G],components:{"kifu-to":t=>function({children:e,node:t,KifuToComponent:r}){const n=w.default.createElement(w.default.Fragment,null,e);if(!t)return n;if("string"!=typeof e)return n;const[i,u]=e.split(":"),a=t.properties.label?String(t.properties.label):void 0;return w.default.createElement(r,{id:i,ply:u,label:a,children:e})}({...t,document:e,KifuToComponent:o}),"link-card":t=>function({children:e,node:t,document:r,LinkCardComponent:n}){if(!t)return C.default.createElement("p",null,e);const i=t.children[0].properties?.href;if(!i)return C.default.createElement("p",null,e);const u=r.websites.find((e=>e.url===i));return u?C.default.createElement(n,{url:u.url,title:u.ogTitle||u.title||u.url,description:u.ogDescription||u.description,domain:u.domain,imageUrl:u.ogImage?.fileUrl??void 0,imageHeight:u.ogImage?.height,imageWidth:u.ogImage?.width,children:e}):C.default.createElement("p",null,e)}({...t,document:e,LinkCardComponent:l}),"x-post":t=>I({...t,document:e,XPostComponent:P}),a:t=>function({href:e,id:t,children:r,LinkComponent:n}){return e?E.default.createElement(n,{href:e,id:t,children:r}):E.default.createElement(E.default.Fragment,null,r)}({...t,document:e,LinkComponent:c}),h1:"h2",img:t=>function({children:e,src:t,width:r,height:n,alt:i,ImageComponent:u}){return t&&r&&n&&i?k.default.createElement(u,{src:t,width:Number(r),height:Number(n),alt:i,children:e}):k.default.createElement(k.default.Fragment,null,e)}({...t,document:e,ImageComponent:a}),pre:t=>function({children:e,node:t,document:r,CodeBlockComponent:n}){const i=x.default.createElement(x.default.Fragment,null,e);if(!t)return i;const u=t.children[0];if("element"!==u.type||"code"!==u.tagName)return i;const a=u.children[0];if("text"!==a.type)return i;const o=u.properties.className,l=a.value,c=/language-(.+)/.exec(o||""),d=c&&c[1]?c[1]:"";return x.default.createElement(n,{code:l,language:d,document:r,children:e})}({...t,document:e,CodeBlockComponent:u}),youtube:t=>N({...t,document:e,YoutubeComponent:L})}};return f.default.createElement(s.default,{className:r&&r.main,...O},e.content)}
1
+ "use strict";var e,t=Object.create,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,u=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,u,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of i(t))a.call(e,l)||l===u||r(e,l,{get:()=>t[l],enumerable:!(o=n(t,l))||o.enumerable});return e},l=(e,n,i)=>(i=null!=e?t(u(e)):{},o(!n&&e&&e.__esModule?i:r(i,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})(c,{DocumentContent:()=>V}),module.exports=(e=c,o(r({},"__esModule",{value:!0}),e));var d=l(require("deepmerge")),f=l(require("react")),s=l(require("react-markdown")),m=l(require("rehype-katex")),p=l(require("rehype-raw")),h=l(require("rehype-sanitize")),g=l(require("rehype-slug")),v=l(require("remark-directive")),b=l(require("remark-directive-rehype")),y=l(require("remark-gfm")),q=l(require("remark-math")),E=l(require("react"));var k=l(require("react"));var w=l(require("react"));var C=l(require("react"));var x=l(require("react"));var P=l(require("react"));function I({children:e,node:t,XPostComponent:r}){if(!t)return P.default.createElement("p",null,e);const n=t.children[0].properties?.href;if(!n||"string"!=typeof n)return P.default.createElement("p",null,e);const i=function(e){try{const t=new URL(e);if(/(^|\.)(twitter|x).com$/.test(t.host))return t.pathname.match(/\/status(es)?\/(\d+)/)?.[2]}catch{return}}(n);return i?P.default.createElement(r,{id:i,children:e}):P.default.createElement("p",null,e)}var L=l(require("react"));function N({children:e,node:t,YoutubeComponent:r}){const n=L.default.createElement("p",null,e);if(!t)return n;const i=t.children[0].properties?.href;if(!i||"string"!=typeof i)return n;const u=function(e){const t=/^https?:\/\/(www\.)?youtube\.com\/watch\?(.*&)?v=(?<videoId>[^&]+)/.exec(e)??/^https?:\/\/youtu\.be\/(?<videoId>[^?]+)/.exec(e)??/^https?:\/\/(www\.)?youtube\.com\/embed\/(?<videoId>[^?]+)/.exec(e);if(t?.groups?.videoId)return t.groups.videoId;return null}(i);if(!u)return n;const a=function(e){try{const t=new URL(e).searchParams.get("t");if(!t)return;return Number(t.endsWith("s")?t.slice(0,-1):t)}catch{return}}(i);return L.default.createElement(r,{videoId:u,params:{start:a},children:e})}var O=l(require("react"));function F(e){return O.default.createElement("div",null,O.default.createElement("pre",null,e.code))}var U=l(require("react"));function $({src:e,width:t,height:r,alt:n}){return U.default.createElement("img",{src:e,width:t,height:r,alt:n})}var j=l(require("react"));function R({id:e,ply:t,label:r}){const n=`?ply=${t}#${`user-content-${e}`}`,i=r??`${t}手目`;return j.default.createElement("a",{href:n},i)}var T=l(require("react"));function W({href:e,id:t,children:r}){return T.default.createElement("a",{href:e,id:t},r)}var D=l(require("react"));function _({url:e,title:t}){return D.default.createElement("p",null,D.default.createElement("a",{href:e},t))}var B=l(require("react"));function K({children:e}){return B.default.createElement(B.default.Fragment,null,e)}var M=l(require("react"));function S({children:e}){return M.default.createElement(M.default.Fragment,null,e)}var X=l(require("path")),Y=l(require("mustache")),z=require("unist-util-visit");function H({document:e,permaLinkFormat:t}){return r=>{(0,z.visit)(r,"element",(r=>{const n=r.properties.href||r.properties.src,i=r.tagName;if(!n||"string"!=typeof n||function(e){try{return new URL(e),!0}catch(e){return!1}}(n)||!e.path)return;const u=`/${X.default.dirname(e.path)}`,a=X.default.resolve(u,decodeURI(n)).replace(/^\//,"");if("a"===i){const n=e.outboundLinkDocuments.find((e=>e.path===a));n&&(r.properties.href=Y.default.render(t,n))}if("img"===i){const t=e.assets.find((e=>e.path===a));t&&(r.properties.src=t.fileUrl,r.properties.height=t.height,r.properties.width=t.width,r.properties.alt=r.properties.alt||t.name)}}))}}var A=require("unist-util-visit");function G(e){return t=>{(0,A.visit)(t,"element",(t=>{const r=t.properties.id,n=e&&"string"==typeof e.clobberPrefix?e.clobberPrefix:"user-content-";"string"==typeof r&&r.startsWith(n)&&(t.properties.id=decodeURI(r))}))}}var J=require("unist-util-visit");function Q(e){return t=>{(0,J.visit)(t,"element",(t=>{const r=t.tagName,n=t.properties.href,i=e&&"string"==typeof e.clobberPrefix?e.clobberPrefix:"user-content-";"a"===r&&"string"==typeof n&&(n.startsWith("#fn-")||n.startsWith("#fnref-"))&&(t.properties.href=`#${i}`+n.replace("#",""))}))}}function V({document:e,permaLinkFormat:t,style:r,components:n}){const i=(0,d.default)(h.defaultSchema,{attributes:{div:[["className",/^sr-only$/]]},tagNames:["link-card","x-post","youtube","kifu-to"]}),u=n?.codeBlock??F,a=n?.image??$,o=n?.kifuTo??R,l=n?.linkCard??_,c=n?.link??W,P=n?.xPost??K,L=n?.youtube??S,O={remarkRehypeOptions:{footnoteLabelTagName:"div",clobberPrefix:""},remarkPlugins:[y.default,q.default,v.default,b.default],rehypePlugins:[p.default,[h.default,i],g.default,m.default,[H,{document:e,permaLinkFormat:t}],Q,G],components:{"kifu-to":t=>function({children:e,node:t,KifuToComponent:r}){const n=w.default.createElement(w.default.Fragment,null,e);if(!t)return n;if("string"!=typeof e)return n;const[i,u]=e.split(":"),a=t.properties.label?String(t.properties.label):void 0;return w.default.createElement(r,{id:i,ply:u,label:a,children:e})}({...t,document:e,KifuToComponent:o}),"link-card":t=>function({children:e,node:t,document:r,LinkCardComponent:n}){if(!t)return C.default.createElement("p",null,e);const i=t.children[0].properties?.href;if(!i)return C.default.createElement("p",null,e);const u=r.websites.find((e=>e.url===i));return u?C.default.createElement(n,{url:u.url,title:u.ogTitle||u.title||u.url,description:u.ogDescription||u.description,domain:u.domain,imageUrl:u.ogImage?.fileUrl??void 0,imageHeight:u.ogImage?.height,imageWidth:u.ogImage?.width,children:e}):C.default.createElement("p",null,e)}({...t,document:e,LinkCardComponent:l}),"x-post":t=>I({...t,document:e,XPostComponent:P}),a:t=>function({href:e,id:t,children:r,LinkComponent:n}){return e?E.default.createElement(n,{href:e,id:t,children:r}):E.default.createElement(E.default.Fragment,null,r)}({...t,document:e,LinkComponent:c}),h1:"h2",img:t=>function({children:e,src:t,width:r,height:n,alt:i,ImageComponent:u}){return t&&r&&n&&i?k.default.createElement(u,{src:t,width:Number(r),height:Number(n),alt:i,children:e}):k.default.createElement(k.default.Fragment,null,e)}({...t,document:e,ImageComponent:a}),pre:t=>function({children:e,node:t,document:r,CodeBlockComponent:n}){const i=x.default.createElement(x.default.Fragment,null,e);if(!t)return i;const u=t.children[0];if("element"!==u.type||"code"!==u.tagName)return i;const a=u.children[0];if("text"!==a.type)return i;const o=u.properties.className,l=a.value,c=/language-(.+)/.exec(o||""),d=c&&c[1]?c[1]:"";return x.default.createElement(n,{code:l,language:d,document:r,children:e})}({...t,document:e,CodeBlockComponent:u}),youtube:t=>N({...t,document:e,YoutubeComponent:L})}};return f.default.createElement(s.default,{className:r&&r.main,...O},e.content)}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{DocumentContent as m}from"./chunk-NCRMT2TF.mjs";import"./chunk-FLTUTZXL.mjs";import"./chunk-SZ4JBPX3.mjs";import"./chunk-DMHUI7N4.mjs";import"./chunk-KWMHEAK7.mjs";import"./chunk-VAJW32XH.mjs";import"./chunk-V3EETEZ2.mjs";import"./chunk-PRANC7GD.mjs";import"./chunk-4AECATS3.mjs";import"./chunk-O2ZRKYA4.mjs";import"./chunk-G64LX7GY.mjs";import"./chunk-GBGPKOHZ.mjs";import"./chunk-WCR2TQ7A.mjs";import"./chunk-X6VPHWKN.mjs";import"./chunk-RJXUMWGD.mjs";import"./chunk-PUVQXCMZ.mjs";import"./chunk-3T5XKKF2.mjs";import"./chunk-BKU6TR65.mjs";import"./chunk-KBFID3JF.mjs";import"./chunk-LSMKHHUW.mjs";import"./chunk-WONBYQ3V.mjs";import"./chunk-KHY6ACRD.mjs";import"./chunk-SPGHZ4ZA.mjs";export{m as DocumentContent};
1
+ import{DocumentContent as m}from"./chunk-QZS75SC2.mjs";import"./chunk-FLTUTZXL.mjs";import"./chunk-SZ4JBPX3.mjs";import"./chunk-V3EETEZ2.mjs";import"./chunk-VAJW32XH.mjs";import"./chunk-KWMHEAK7.mjs";import"./chunk-DMHUI7N4.mjs";import"./chunk-PRANC7GD.mjs";import"./chunk-4AECATS3.mjs";import"./chunk-O2ZRKYA4.mjs";import"./chunk-5SIG5F5U.mjs";import"./chunk-GBGPKOHZ.mjs";import"./chunk-WCR2TQ7A.mjs";import"./chunk-X6VPHWKN.mjs";import"./chunk-RJXUMWGD.mjs";import"./chunk-PUVQXCMZ.mjs";import"./chunk-3T5XKKF2.mjs";import"./chunk-BKU6TR65.mjs";import"./chunk-KBFID3JF.mjs";import"./chunk-LSMKHHUW.mjs";import"./chunk-WONBYQ3V.mjs";import"./chunk-KHY6ACRD.mjs";import"./chunk-SPGHZ4ZA.mjs";export{m as DocumentContent};
@@ -1 +1 @@
1
- "use strict";var e,t=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,n=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,p=(e,t,n,p)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of o(t))s.call(e,a)||a===n||r(e,a,{get:()=>t[a],enumerable:!(p=i(t,a))||p.enumerable});return e},a=(e,i,o)=>(o=null!=e?t(n(e)):{},p(!i&&e&&e.__esModule?o:r(o,"default",{value:e,enumerable:!0}),e)),u={};((e,t)=>{for(var i in t)r(e,i,{get:t[i],enumerable:!0})})(u,{processInternalLinks:()=>h,rehypeClobberUrlDecode:()=>d,rehypeFootnoteLinks:()=>y}),module.exports=(e=u,p(r({},"__esModule",{value:!0}),e));var c=a(require("path")),f=a(require("mustache")),l=require("unist-util-visit");function h({document:e,permaLinkFormat:t}){return r=>{(0,l.visit)(r,"element",(r=>{const i=r.properties.href||r.properties.src,o=r.tagName;if(!i||"string"!=typeof i||function(e){try{return new URL(e),!0}catch(e){return!1}}(i)||!e.path)return;const n=`/${c.dirname(e.path)}`,s=c.resolve(n,decodeURI(i)).replace(/^\//,"");if("a"===o){const i=e.outboundLinkDocuments.find((e=>e.path===s));i&&(r.properties.href=f.default.render(t,i))}if("img"===o){const t=e.assets.find((e=>e.path===s));t&&(r.properties.src=t.fileUrl,r.properties.height=t.height,r.properties.width=t.width,r.properties.alt=r.properties.alt||t.name)}}))}}var b=require("unist-util-visit");function d(e){return t=>{(0,b.visit)(t,"element",(t=>{const r=t.properties.id,i=e&&"string"==typeof e.clobberPrefix?e.clobberPrefix:"user-content-";"string"==typeof r&&r.startsWith(i)&&(t.properties.id=decodeURI(r))}))}}var m=require("unist-util-visit");function y(e){return t=>{(0,m.visit)(t,"element",(t=>{const r=t.tagName,i=t.properties.href,o=e&&"string"==typeof e.clobberPrefix?e.clobberPrefix:"user-content-";"a"===r&&"string"==typeof i&&(i.startsWith("#fn-")||i.startsWith("#fnref-"))&&(t.properties.href=`#${o}`+i.replace("#",""))}))}}
1
+ "use strict";var e,t=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,n=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,p=(e,t,n,p)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of o(t))s.call(e,a)||a===n||r(e,a,{get:()=>t[a],enumerable:!(p=i(t,a))||p.enumerable});return e},a=(e,i,o)=>(o=null!=e?t(n(e)):{},p(!i&&e&&e.__esModule?o:r(o,"default",{value:e,enumerable:!0}),e)),u={};((e,t)=>{for(var i in t)r(e,i,{get:t[i],enumerable:!0})})(u,{processInternalLinks:()=>d,rehypeClobberUrlDecode:()=>b,rehypeFootnoteLinks:()=>y}),module.exports=(e=u,p(r({},"__esModule",{value:!0}),e));var c=a(require("path")),f=a(require("mustache")),l=require("unist-util-visit");function d({document:e,permaLinkFormat:t}){return r=>{(0,l.visit)(r,"element",(r=>{const i=r.properties.href||r.properties.src,o=r.tagName;if(!i||"string"!=typeof i||function(e){try{return new URL(e),!0}catch(e){return!1}}(i)||!e.path)return;const n=`/${c.default.dirname(e.path)}`,s=c.default.resolve(n,decodeURI(i)).replace(/^\//,"");if("a"===o){const i=e.outboundLinkDocuments.find((e=>e.path===s));i&&(r.properties.href=f.default.render(t,i))}if("img"===o){const t=e.assets.find((e=>e.path===s));t&&(r.properties.src=t.fileUrl,r.properties.height=t.height,r.properties.width=t.width,r.properties.alt=r.properties.alt||t.name)}}))}}var h=require("unist-util-visit");function b(e){return t=>{(0,h.visit)(t,"element",(t=>{const r=t.properties.id,i=e&&"string"==typeof e.clobberPrefix?e.clobberPrefix:"user-content-";"string"==typeof r&&r.startsWith(i)&&(t.properties.id=decodeURI(r))}))}}var m=require("unist-util-visit");function y(e){return t=>{(0,m.visit)(t,"element",(t=>{const r=t.tagName,i=t.properties.href,o=e&&"string"==typeof e.clobberPrefix?e.clobberPrefix:"user-content-";"a"===r&&"string"==typeof i&&(i.startsWith("#fn-")||i.startsWith("#fnref-"))&&(t.properties.href=`#${o}`+i.replace("#",""))}))}}
@@ -1 +1 @@
1
- import"../chunk-O2ZRKYA4.mjs";import{processInternalLinks as m}from"../chunk-G64LX7GY.mjs";import{rehypeClobberUrlDecode as o}from"../chunk-GBGPKOHZ.mjs";import{rehypeFootnoteLinks as r}from"../chunk-WCR2TQ7A.mjs";import"../chunk-X6VPHWKN.mjs";import"../chunk-RJXUMWGD.mjs";export{m as processInternalLinks,o as rehypeClobberUrlDecode,r as rehypeFootnoteLinks};
1
+ import"../chunk-O2ZRKYA4.mjs";import{processInternalLinks as m}from"../chunk-5SIG5F5U.mjs";import{rehypeClobberUrlDecode as o}from"../chunk-GBGPKOHZ.mjs";import{rehypeFootnoteLinks as r}from"../chunk-WCR2TQ7A.mjs";import"../chunk-X6VPHWKN.mjs";import"../chunk-RJXUMWGD.mjs";export{m as processInternalLinks,o as rehypeClobberUrlDecode,r as rehypeFootnoteLinks};
@@ -1 +1 @@
1
- "use strict";var e,t=Object.create,r=Object.defineProperty,o=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty,a=(e,t,n,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of i(t))p.call(e,s)||s===n||r(e,s,{get:()=>t[s],enumerable:!(a=o(t,s))||a.enumerable});return e},s=(e,o,i)=>(i=null!=e?t(n(e)):{},a(!o&&e&&e.__esModule?i:r(i,"default",{value:e,enumerable:!0}),e)),u={};((e,t)=>{for(var o in t)r(e,o,{get:t[o],enumerable:!0})})(u,{default:()=>d}),module.exports=(e=u,a(r({},"__esModule",{value:!0}),e));var c=s(require("path")),l=s(require("mustache")),f=require("unist-util-visit");function d({document:e,permaLinkFormat:t}){return r=>{(0,f.visit)(r,"element",(r=>{const o=r.properties.href||r.properties.src,i=r.tagName;if(!o||"string"!=typeof o||function(e){try{return new URL(e),!0}catch(e){return!1}}(o)||!e.path)return;const n=`/${c.dirname(e.path)}`,p=c.resolve(n,decodeURI(o)).replace(/^\//,"");if("a"===i){const o=e.outboundLinkDocuments.find((e=>e.path===p));o&&(r.properties.href=l.default.render(t,o))}if("img"===i){const t=e.assets.find((e=>e.path===p));t&&(r.properties.src=t.fileUrl,r.properties.height=t.height,r.properties.width=t.width,r.properties.alt=r.properties.alt||t.name)}}))}}
1
+ "use strict";var e,t=Object.create,r=Object.defineProperty,o=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,p=(e,t,n,p)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let u of i(t))a.call(e,u)||u===n||r(e,u,{get:()=>t[u],enumerable:!(p=o(t,u))||p.enumerable});return e},u=(e,o,i)=>(i=null!=e?t(n(e)):{},p(!o&&e&&e.__esModule?i:r(i,"default",{value:e,enumerable:!0}),e)),s={};((e,t)=>{for(var o in t)r(e,o,{get:t[o],enumerable:!0})})(s,{default:()=>d}),module.exports=(e=s,p(r({},"__esModule",{value:!0}),e));var c=u(require("path")),l=u(require("mustache")),f=require("unist-util-visit");function d({document:e,permaLinkFormat:t}){return r=>{(0,f.visit)(r,"element",(r=>{const o=r.properties.href||r.properties.src,i=r.tagName;if(!o||"string"!=typeof o||function(e){try{return new URL(e),!0}catch(e){return!1}}(o)||!e.path)return;const n=`/${c.default.dirname(e.path)}`,a=c.default.resolve(n,decodeURI(o)).replace(/^\//,"");if("a"===i){const o=e.outboundLinkDocuments.find((e=>e.path===a));o&&(r.properties.href=l.default.render(t,o))}if("img"===i){const t=e.assets.find((e=>e.path===a));t&&(r.properties.src=t.fileUrl,r.properties.height=t.height,r.properties.width=t.width,r.properties.alt=r.properties.alt||t.name)}}))}}
@@ -1 +1 @@
1
- import{processInternalLinks as m}from"../chunk-G64LX7GY.mjs";import"../chunk-X6VPHWKN.mjs";import"../chunk-RJXUMWGD.mjs";export{m as default};
1
+ import{processInternalLinks as m}from"../chunk-5SIG5F5U.mjs";import"../chunk-X6VPHWKN.mjs";import"../chunk-RJXUMWGD.mjs";export{m as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hackersheet/react-document-content",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.2",
4
4
  "description": "Hacker Sheet document content component for React.",
5
5
  "keywords": [],
6
6
  "repository": {
@@ -35,6 +35,7 @@
35
35
  "@hackersheet/core": "alpha",
36
36
  "deepmerge": "^4.0.0",
37
37
  "mustache": "^4.0.0",
38
+ "path": "^0.12.7",
38
39
  "react-markdown": "^9.0.0",
39
40
  "rehype-katex": "^7.0.0",
40
41
  "rehype-raw": "^7.0.0",
@@ -1 +0,0 @@
1
- import{isUrl as e}from"./chunk-RJXUMWGD.mjs";import*as t from"path";import r from"mustache";import{visit as i}from"unist-util-visit";function o({document:o,permaLinkFormat:p}){return s=>{i(s,"element",(i=>{const s=i.properties.href||i.properties.src,n=i.tagName;if(!s||"string"!=typeof s||e(s)||!o.path)return;const m=`/${t.dirname(o.path)}`,a=t.resolve(m,decodeURI(s)).replace(/^\//,"");if("a"===n){const e=o.outboundLinkDocuments.find((e=>e.path===a));e&&(i.properties.href=r.render(p,e))}if("img"===n){const e=o.assets.find((e=>e.path===a));e&&(i.properties.src=e.fileUrl,i.properties.height=e.height,i.properties.width=e.width,i.properties.alt=i.properties.alt||e.name)}}))}}export{o as processInternalLinks};
@@ -1 +0,0 @@
1
- import{CodeBlock as m}from"./chunk-SZ4JBPX3.mjs";import{LinkCard as o}from"./chunk-DMHUI7N4.mjs";import{KifuTo as r}from"./chunk-KWMHEAK7.mjs";import{Link as t}from"./chunk-VAJW32XH.mjs";import{Image as e}from"./chunk-V3EETEZ2.mjs";import{XPost as n}from"./chunk-PRANC7GD.mjs";import{Youtube as i}from"./chunk-4AECATS3.mjs";import{processInternalLinks as p}from"./chunk-G64LX7GY.mjs";import{rehypeClobberUrlDecode as c}from"./chunk-GBGPKOHZ.mjs";import{rehypeFootnoteLinks as u}from"./chunk-WCR2TQ7A.mjs";import{XPostComponentResolver as k}from"./chunk-3T5XKKF2.mjs";import{YoutubeComponentResolver as s}from"./chunk-BKU6TR65.mjs";import{AComponentResolver as a}from"./chunk-KBFID3JF.mjs";import{ImgComponentResolver as f}from"./chunk-LSMKHHUW.mjs";import{KifuToComponentResolver as h}from"./chunk-WONBYQ3V.mjs";import{LinkCardComponentResolver as d}from"./chunk-KHY6ACRD.mjs";import{PreComponentResolver as j}from"./chunk-SPGHZ4ZA.mjs";import l from"deepmerge";import C from"react";import y from"react-markdown";import g from"rehype-katex";import K from"rehype-raw";import P,{defaultSchema as b}from"rehype-sanitize";import A from"rehype-slug";import H from"remark-directive";import T from"remark-directive-rehype";import B from"remark-gfm";import L from"remark-math";function N({document:N,permaLinkFormat:x,style:E,components:G}){const F=l(b,{attributes:{div:[["className",/^sr-only$/]]},tagNames:["link-card","x-post","youtube","kifu-to"]}),R=G?.codeBlock??m,W=G?.image??e,X=G?.kifuTo??r,Z=G?.linkCard??o,v=G?.link??t,D=G?.xPost??n,S=G?.youtube??i,Y={remarkRehypeOptions:{footnoteLabelTagName:"div",clobberPrefix:""},remarkPlugins:[B,L,H,T],rehypePlugins:[K,[P,F],A,g,[p,{document:N,permaLinkFormat:x}],u,c],components:{"kifu-to":m=>h({...m,document:N,KifuToComponent:X}),"link-card":m=>d({...m,document:N,LinkCardComponent:Z}),"x-post":m=>k({...m,document:N,XPostComponent:D}),a:m=>a({...m,document:N,LinkComponent:v}),h1:"h2",img:m=>f({...m,document:N,ImageComponent:W}),pre:m=>j({...m,document:N,CodeBlockComponent:R}),youtube:m=>s({...m,document:N,YoutubeComponent:S})}};return C.createElement(y,{className:E&&E.main,...Y},N.content)}export{N as DocumentContent};