mdpreview/templates/base.html
2026-03-29 09:24:50 +03:00

215 lines
6.8 KiB
HTML

<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Note{% endblock %}</title>
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
<style>
body {
background-color: #121212;
color: #e0e0e0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
margin: 0;
padding: 40px 20px;
display: flex;
justify-content: center;
line-height: 1.6;
}
.content {
max-width: 800px;
width: 100%;
background-color: #1e1e1e;
padding: 40px;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
a { color: #bb86fc; text-decoration: none !important; }
h1, h2, h3, h4 { color: #ffffff; margin-top: 1.5em; margin-bottom: 0.5em; }
h1 { border-bottom: 1px solid #333; padding-bottom: 10px; }
table { border-collapse: collapse; width: 100%; margin: 1em 0; }
th, td { border: 1px solid #444; padding: 8px; text-align: left; }
th { background-color: #2c2c2c; }
blockquote {
border-left: 4px solid #bb86fc;
margin: 1em 0;
padding-left: 1em;
color: #aaa;
background: #252525;
padding: 10px;
}
code { font-family: 'Consolas', 'Monaco', monospace; }
p > code, li > code {
background-color: #2c2c2c;
padding: 2px 6px;
border-radius: 4px;
color: #ff79c6;
}
.header a { padding: 1em; color: #757575; font-size: 0.95em; }
.code-block-wrapper {
margin: 1em 0;
border: 1px solid #444;
border-radius: 6px;
overflow: hidden;
background-color: #2b303b;
}
.code-header {
display: flex;
justify-content: space-between;
align-items: center;
background-color: #232730;
padding: 6px 12px;
border-bottom: 1px solid #444;
font-size: 0.85em;
color: #a0a0a0;
}
.code-lang { font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px; }
.copy-btn {
background: transparent;
border: 1px solid #555;
color: #ccc;
padding: 2px 8px;
border-radius: 4px;
cursor: pointer;
font-size: 0.8em;
transition: all 0.2s;
}
.copy-btn:hover { background-color: #444; color: #fff; border-color: #777; }
.copy-btn:active { transform: scale(0.95); }
.copy-path-btn {
background: transparent;
color: #ccc;
border-radius: 4px;
cursor: pointer;
font-size: 0.8em;
transition: all 0.2s;
}
.copy-path-btn:hover { background-color: #444; color: #fff; border-color: #777; }
.copy-path-btn:active { transform: scale(0.95); }
pre { padding: 15px; overflow-x: auto; margin: 0; }
pre code { background: transparent; padding: 0; color: inherit; }
.mermaid-wrapper .mermaid {
background-color: #f9f9f9;
border-radius: 0 0 6px 6px;
display: flex;
justify-content: center;
}
.footer {
margin-top: 30px;
color: #666;
font-size: 0.9em;
border-top: 1px solid #333;
padding-top: 15px;
}
.footer a { padding: 1em; color: #757575; }
.back-link {
display: inline-flex;
align-items: center;
color: #90a4ae;
text-decoration: none;
font-size: 0.95em;
transition: color 0.2s;
}
.back-link span { margin-right: 8px; font-size: 1.2em; }
img {
max-width: 100%;
height: auto;
display: block;
margin: 1.5em auto;
border-radius: 6px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
ul {
list-style-type: disc;
padding: 0;
margin: 0;
padding-left: 1.5em;
}
ol {
padding-left: 1.5em;
list-style-type: decimal;
}
li {
padding: .5em 0;
}
ul > li::marker, ol > li::marker { display: inline-block; }
.file-link {
color: #64b5f6;
font-size: 1.1em;
display: flex;
align-items: center;
}
.file-link:hover {
color: #90caf9;
}
.icon {
margin-right: 10px;
min-width: 24px;
}
</style>
</head>
<body>
<div class="content">
<div class="header">
{% block header %}
<a href="/" class="back-link" onmouseover="this.style.color='#ffffff'" onmouseout="this.style.color='#90a4ae'">
<span></span> Back
</a>
<a href="/random">🎲 Random note</a>
{% endblock %}
</div>
{% block content %}{% endblock %}
<div class="footer">
<a href="/">← Main</a>
<a href="/random">🎲 Random note</a>
{% block footer %}
<p>{{ package_name }} v{{ version }}</p>
{% endblock %}
</div>
</div>
<script>
{% block scripts %}{% endblock %}
function copyCode(button) {
const wrapper = button.closest('.code-block-wrapper');
if (!wrapper) return;
const target = wrapper.querySelector('pre') || wrapper.querySelector('.mermaid');
if (!target) return;
const codeText = target.innerText;
navigator.clipboard.writeText(codeText).then(() => {
const originalText = button.innerText;
button.innerText = 'Copied!';
button.style.borderColor = '#2ecc71';
button.style.color = '#2ecc71';
setTimeout(() => {
button.innerText = originalText;
button.style.borderColor = '';
button.style.color = '';
}, 2000);
}).catch(err => {
console.error('Error copying:', err);
button.innerText = 'Error';
});
}
function copyPath(path) {
navigator.clipboard.writeText(path).then(() => {}).catch(err => {
console.error('Error copying:', err);
button.innerText = 'Error';
});
}
mermaid.initialize({
startOnLoad: true,
theme: 'dark',
securityLevel: 'loose',
});
</script>
</body>
</html>