admin08077 commited on
Commit
d13f774
·
verified ·
1 Parent(s): 016eb24

Upload 2 files

Browse files
assets/index-B0jXtc3l.js ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))l(n);new MutationObserver(n=>{for(const e of n)if(e.type==="childList")for(const t of e.addedNodes)t.tagName==="LINK"&&t.rel==="modulepreload"&&l(t)}).observe(document,{childList:!0,subtree:!0});function d(n){const e={};return n.integrity&&(e.integrity=n.integrity),n.referrerPolicy&&(e.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?e.credentials="include":n.crossOrigin==="anonymous"?e.credentials="omit":e.credentials="same-origin",e}function l(n){if(n.ep)return;n.ep=!0;const e=d(n);fetch(n.href,e)}})();let p=null,M=0;const w=document.getElementById("content-area"),S=document.getElementById("upload-md-btn"),y=document.getElementById("download-md-btn"),u=document.getElementById("download-html-btn");marked.setOptions({highlight:function(o,r){const d=hljs.getLanguage(r)?r:"plaintext";return hljs.highlight(o,{language:d}).value},langPrefix:"hljs language-",gfm:!0,breaks:!0});mermaid.initialize({startOnLoad:!1,theme:"default",securityLevel:"loose"});function E(){var o;w.innerHTML=`
2
+ <div class="upload-prompt">
3
+ <h2>Upload a Markdown file to view its content</h2>
4
+ <button id="upload-prompt-btn" class="upload-prompt-btn">Select File</button>
5
+ </div>
6
+ `,(o=document.getElementById("upload-prompt-btn"))==null||o.addEventListener("click",v),y.classList.add("hidden"),u.classList.add("hidden")}async function x(o){w.innerHTML='<div id="preview-output" role="document" aria-live="polite">Rendering...</div>';const r=document.getElementById("preview-output"),d=marked.parse(o),l=new DOMParser().parseFromString(d,"text/html"),n=l.querySelectorAll("code.language-mermaid");for(const e of Array.from(n)){let t=e.textContent||"";const c=s=>(i,a)=>{const m=a.trim();if(!m||m.startsWith('"')&&m.endsWith('"')||m.startsWith("'")&&m.endsWith("'")||/^[a-zA-Z0-9_-]+$/.test(m))return i;const g=a.replace(/"/g,"&quot;");return`${s[0]}"${g}"${s[1]}`};t=t.replace(new RegExp("(?<=\\S)(?<!-)\\(\\(([\\s\\S]*?)\\)\\)","g"),c(["((","))"])),t=t.replace(new RegExp("(?<=\\S)(?<!-)\\[\\[([\\s\\S]*?)\\]\\]","g"),c(["[[","]]"])),t=t.replace(new RegExp("(?<=\\S)(?<!-)\\(\\[([\\s\\S]*?)\\]\\)","g"),c(["([","])"])),t=t.replace(new RegExp("(?<=\\S)(?<!-)\\[\\(([\\s\\S]*?)\\)\\]","g"),c(["[(",")]"])),t=t.replace(new RegExp("(?<=\\S)(?<!-)\\{\\{([\\s\\S]*?)\\}\\}","g"),c(["{{","}}"])),t=t.replace(new RegExp("(?<=\\S)(?<!-)\\[([\\s\\S]*?)\\]","g"),c(["[","]"])),t=t.replace(new RegExp("(?<=\\S)(?<!-)\\(([\\s\\S]*?)\\)","g"),c(["(",")"])),t=t.replace(new RegExp("(?<=\\S)(?<!-)\\{([\\s\\S]*?)\\}","g"),c(["{","}"]));const h=e.parentElement;if(h){const s=document.createElement("div"),i=`mermaid-svg-${M++}`;s.className="mermaid",s.id=i;try{const{svg:a}=await mermaid.render(i,t);s.innerHTML=a,h.replaceWith(s)}catch(a){s.innerHTML="Error rendering Mermaid diagram.",s.style.color="red",h.replaceWith(s),console.error("Mermaid render error:",a)}}}r.innerHTML="",r.append(...Array.from(l.body.children));try{renderMathInElement(r,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"$",right:"$",display:!1},{left:"\\(",right:"\\)",display:!1},{left:"\\[",right:"\\]",display:!0}],throwOnError:!1})}catch(e){console.error("KaTeX render error:",e)}}function b(o,r,d){const l=new Blob([o],{type:d}),n=URL.createObjectURL(l),e=document.createElement("a");e.href=n,e.download=r,document.body.appendChild(e),e.click(),document.body.removeChild(e),URL.revokeObjectURL(n)}function v(){const o=document.createElement("input");o.type="file",o.accept=".md, .markdown, text/markdown",o.onchange=r=>{var l;const d=(l=r.target.files)==null?void 0:l[0];if(d){const n=new FileReader;n.onload=async e=>{var t;p=(t=e.target)==null?void 0:t.result,p!==null&&(await x(p),y.classList.remove("hidden"),u.classList.remove("hidden"))},n.readAsText(d)}},o.click()}function C(){p!==null?b(p,"document.md","text/markdown"):alert("No markdown file is loaded to download.")}async function T(){const o=document.getElementById("preview-output");if(!o){alert("No content has been rendered to download.");return}u.disabled=!0,u.textContent="Preparing...";try{const r=o.cloneNode(!0),l=Array.from(r.querySelectorAll("img")).map(async i=>{if(!i.src.startsWith("data:"))try{const a=await fetch(i.src);if(!a.ok){console.warn(`Could not fetch image for inlining: ${i.src}`);return}const m=await a.blob(),g=await new Promise((L,k)=>{const f=new FileReader;f.onloadend=()=>L(f.result),f.onerror=k,f.readAsDataURL(m)});i.src=g}catch(a){console.error(`Error inlining image ${i.src}:`,a)}});await Promise.all(l);const e=["index.css","https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css","https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css"].map(i=>fetch(i).then(a=>a.ok?a.text():"")),s=`
7
+ <!DOCTYPE html>
8
+ <html lang="en">
9
+ <head>
10
+ <meta charset="UTF-8">
11
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
12
+ <title>Markdown Export</title>
13
+ <style>
14
+ /* All application and syntax highlighting styles (cleaned) */
15
+ ${(await Promise.all(e)).join(`
16
+
17
+ `).replace(/html\s*,\s*body\s*\{[^}]+\}/g,"")}
18
+
19
+ /* Essential styles for a scrollable, static HTML document */
20
+ html {
21
+ height: auto;
22
+ overflow: auto;
23
+ }
24
+ body {
25
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
26
+ background-color: #1a1b26; /* Re-apply base styles from :root */
27
+ color: #c0caf5;
28
+ font-size: 16px;
29
+ height: auto;
30
+ overflow: auto;
31
+ display: block;
32
+ padding: 2rem;
33
+ margin: 0;
34
+ }
35
+ </style>
36
+ </head>
37
+ <body>
38
+ <div id="preview-output" role="document">
39
+ ${r.innerHTML}
40
+ </div>
41
+ </body>
42
+ </html>`.trim();b(s,"document.html","text/html")}catch(r){console.error("Failed to generate HTML file:",r),alert("Sorry, there was an error creating the HTML file.")}finally{u.disabled=!1,u.textContent="Download HTML"}}S.addEventListener("click",v);y.addEventListener("click",C);u.addEventListener("click",T);E();
assets/index-lnqoJdL2.css ADDED
@@ -0,0 +1 @@
 
 
1
+ :root{--bg-color: #1a1b26;--editor-bg: #24283b;--preview-bg: #1e1f2c;--text-color: #c0caf5;--header-bg: #1f202e;--border-color: #3b4261;--accent-color: #7aa2f7;--accent-hover-color: #9eceff;--button-bg: #414868;--button-hover-bg: #565f89;--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--font-mono: "SF Mono", "Fira Code", "Menlo", "Consolas", monospace}*{box-sizing:border-box;margin:0;padding:0}html,body{height:100%;font-family:var(--font-sans);background-color:var(--bg-color);color:var(--text-color);font-size:16px;overflow:hidden}.hidden{display:none!important}#app-container{display:flex;flex-direction:column;height:100vh}header{display:flex;justify-content:space-between;align-items:center;padding:.75rem 1.5rem;background-color:var(--header-bg);border-bottom:1px solid var(--border-color);flex-shrink:0}header h1{font-size:1.25rem;font-weight:600}#controls button{background-color:var(--button-bg);color:var(--text-color);border:none;padding:.5rem 1rem;border-radius:5px;cursor:pointer;font-weight:500;transition:background-color .2s ease;margin-left:.5rem}#controls button:hover,#controls button:focus{background-color:var(--button-hover-bg);outline:2px solid var(--accent-color);outline-offset:2px}#content-area{flex-grow:1;overflow-y:auto;padding:2rem}.upload-prompt{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;text-align:center;color:#a9b1d6}.upload-prompt h2{font-size:1.5rem;margin-bottom:1.5rem;font-weight:500}.upload-prompt-btn{background-color:var(--accent-color);color:var(--bg-color);border:none;padding:1rem 2rem;border-radius:8px;cursor:pointer;font-size:1.1rem;font-weight:600;transition:background-color .2s ease}.upload-prompt-btn:hover{background-color:var(--accent-hover-color)}#preview-output{max-width:860px;margin:0 auto;line-height:1.7;word-wrap:break-word}#preview-output h1,#preview-output h2,#preview-output h3{border-bottom:1px solid var(--border-color);padding-bottom:.3em;margin-top:1.5em;margin-bottom:1em;color:var(--accent-color)}#preview-output h1{font-size:2em}#preview-output h2{font-size:1.5em}#preview-output h3{font-size:1.25em}#preview-output a{color:var(--accent-hover-color);text-decoration:none}#preview-output a:hover{text-decoration:underline}#preview-output p{margin-bottom:1em}#preview-output ul,#preview-output ol{margin-left:1.5rem;margin-bottom:1em}#preview-output li{margin-bottom:.5em}#preview-output pre{background-color:var(--editor-bg);padding:1rem;border-radius:6px;overflow-x:auto;margin-bottom:1em}#preview-output code{font-family:var(--font-mono);font-size:.9em}#preview-output pre code{background:none;padding:0}#preview-output :not(pre)>code{background-color:var(--button-bg);padding:.2em .4em;border-radius:3px}#preview-output blockquote{border-left:4px solid var(--border-color);padding-left:1rem;margin:0 0 1rem;color:#a9b1d6}#preview-output table{width:100%;border-collapse:collapse;margin-bottom:1em}#preview-output th,#preview-output td{border:1px solid var(--border-color);padding:.5rem}#preview-output th{background-color:var(--button-bg)}.mermaid{background-color:#fff;border-radius:6px;padding:1rem;margin-bottom:1rem;text-align:center}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background:var(--editor-bg)}::-webkit-scrollbar-thumb{background:var(--button-bg);border-radius:5px}::-webkit-scrollbar-thumb:hover{background:var(--button-hover-bg)}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(max-width:768px){header{flex-direction:column;align-items:flex-start;gap:.5rem}#controls{align-self:flex-start;margin-left:-.5rem}#content-area{padding:1rem}}