addet some features
This commit is contained in:
parent
0861ae20c3
commit
97e3262506
11 changed files with 1369 additions and 208 deletions
97
app/templates/base.html
Normal file
97
app/templates/base.html
Normal file
|
@ -0,0 +1,97 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
{% block head %}
|
||||
<title>Histogram Viewer</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/digitallytailored/classless@latest/classless.min.css">
|
||||
<link rel="stylesheet" href="https://esm.sh/@wooorm/starry-night@3/style/both">
|
||||
<style>
|
||||
.card {
|
||||
padding: 1rem;
|
||||
border-radius: 0.5rem;
|
||||
background-color: var(--background-color);
|
||||
color: var(--text-color);
|
||||
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.1);
|
||||
border-radius: 1rem;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.card-title {
|
||||
text-decoration: none;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.card-title:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.delete-button {
|
||||
position: relative;
|
||||
float: right;
|
||||
margin: 0;
|
||||
padding: 0.25rem 0.5rem;
|
||||
font-size: 0.8rem;
|
||||
background-color: var(--red);
|
||||
color: var(--text-color);
|
||||
border: none;
|
||||
border-radius: 0.5rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
max-width: 65%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// Dark mode toggle button
|
||||
const darkModeToggle = document.getElementById('darkModeToggle');
|
||||
|
||||
function setColorScheme(scheme) {
|
||||
document.documentElement.setAttribute('color-scheme', scheme);
|
||||
localStorage.setItem('color-scheme', scheme);
|
||||
}
|
||||
|
||||
function getColorScheme() {
|
||||
let scheme = localStorage.getItem('color-scheme');
|
||||
if (scheme) {
|
||||
return scheme;
|
||||
}
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||
}
|
||||
|
||||
setColorScheme(getColorScheme());
|
||||
|
||||
darkModeToggle.addEventListener('click', function () {
|
||||
const newScheme = getColorScheme() === 'dark' ? 'light' : 'dark';
|
||||
setColorScheme(newScheme);
|
||||
});
|
||||
|
||||
darkModeToggle.checked = getColorScheme() === 'dark';
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<nav>
|
||||
<a class="glass" href="{{ url_for('main.index') }}">Home</a>
|
||||
<a class="glass" href="{{ url_for('main.upload_file') }}">Upload</a>
|
||||
<button class="outline" id="darkModeToggle">Toggle Theme</button>
|
||||
</nav>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,91 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Markdown Viewer</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/digitallytailored/classless@latest/classless.min.css">
|
||||
<style>
|
||||
.file-list {
|
||||
margin: 2em 0;
|
||||
}
|
||||
.file-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0.75em;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.file-item:hover {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
.file-link {
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
.file-uri {
|
||||
color: #666;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.copy-button {
|
||||
background: #f0f0f0;
|
||||
border: 1px solid #ddd;
|
||||
padding: 0.25em 0.5em;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
padding: 3em;
|
||||
background-color: #f9f9f9;
|
||||
border-radius: 4px;
|
||||
margin: 2em 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Markdown Viewer</h1>
|
||||
|
||||
<div class="actions">
|
||||
<a href="{{ url_for('main.upload_file') }}" class="button">Upload New Document</a>
|
||||
</div>
|
||||
|
||||
{% if documents %}
|
||||
<div class="file-list">
|
||||
<h2>Available Documents</h2>
|
||||
|
||||
{% for doc in documents %}
|
||||
<div class="file-item">
|
||||
<div>
|
||||
<a href="{{ url_for('main.view_file', uri=doc.uri) }}" class="file-link">
|
||||
{{ doc.filename }}
|
||||
</a>
|
||||
<span class="file-uri">URI: {{ doc.uri }}</span>
|
||||
</div>
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Markdown Viewer</h1>
|
||||
|
||||
<div>
|
||||
<a href="{{ url_for('main.upload_file') }}" class="button">Upload New Document</a>
|
||||
</div>
|
||||
|
||||
{% if documents %}
|
||||
<div class="container">
|
||||
<h2>Available Documents</h2>
|
||||
|
||||
{% for doc in documents %}
|
||||
<div class="card">
|
||||
<!-- <div>
|
||||
<a href="{{ url_for('main.view_file', uri=doc.uri) }}" class="card-title">
|
||||
{{ doc.filename }}
|
||||
</a>
|
||||
<span class="file-uri">URI: {{ doc.uri }}</span>
|
||||
</div> -->
|
||||
<div>
|
||||
<a href="{{ url_for('main.view_file', uri=doc.uri) }}" class="card-title">
|
||||
<h3>{{ doc.filename }}</h3>
|
||||
</a>
|
||||
<form action="{{ url_for('main.index') }}" method="post">
|
||||
<input type="hidden" name="delete_uri" value="{{ doc.uri }}">
|
||||
<button type="submit" class="delete-button">Delete</button>
|
||||
</form>
|
||||
<div>
|
||||
<a href="{{ url_for('main.view_file', uri=doc.uri) }}" class="button">View</a>
|
||||
<button class="copy-button" onclick="copyToClipboard('{{ url_for('main.view_file', uri=doc.uri, _external=True) }}')">
|
||||
Copy Link
|
||||
</button>
|
||||
<button class="copy-button"
|
||||
onclick="copyToClipboard('{{ url_for('main.view_file', uri=doc.uri, _external=True) }}')">Copy
|
||||
Link</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="empty-state">
|
||||
<h3>No documents available</h3>
|
||||
<p>Upload a markdown file to get started!</p>
|
||||
<a href="{{ url_for('main.upload_file') }}" class="button">Upload Now</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
function copyToClipboard(text) {
|
||||
navigator.clipboard.writeText(text).then(function() {
|
||||
alert('Link copied to clipboard!');
|
||||
}, function() {
|
||||
alert('Failed to copy link');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div>
|
||||
<h3>No documents available</h3>
|
||||
<p>Upload a markdown file to get started!</p>
|
||||
<a href="{{ url_for('main.upload_file') }}" class="button">Upload Now</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
function copyToClipboard(text) {
|
||||
navigator.clipboard.writeText(text).then(function () {
|
||||
alert('Link copied to clipboard!');
|
||||
}, function () {
|
||||
alert('Failed to copy link');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -1,39 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Upload Markdown File</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/digitallytailored/classless@latest/classless.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Upload Markdown File</h1>
|
||||
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="messages">
|
||||
{% for message in messages %}
|
||||
<p class="alert">{{ message }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div>
|
||||
<label for="file">Select a markdown file:</label>
|
||||
<input type="file" name="file" id="file" accept=".md">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="custom_uri">Custom URI (optional):</label>
|
||||
<input type="text" name="custom_uri" id="custom_uri" placeholder="e.g., my-document">
|
||||
<small>Leave blank for an auto-generated URI</small>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="submit" value="Upload">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<a href="{{ url_for('main.index') }}">Back to Home</a>
|
||||
</body>
|
||||
</html>
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Upload Markdown File</h1>
|
||||
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="messages">
|
||||
{% for message in messages %}
|
||||
<p class="alert">{{ message }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div>
|
||||
<label for="file">Select a markdown file:</label>
|
||||
<input type="file" name="file" id="file" accept=".md">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="raw_url">Or enter a URL:</label>
|
||||
<input type="url" name="raw_url" id="raw_url" placeholder="https://example.com/markdown-file.md">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="custom_uri">Custom URI (optional):</label>
|
||||
<input type="text" name="custom_uri" id="custom_uri" placeholder="e.g., my-document">
|
||||
<small>Leave blank for an auto-generated URI</small>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button class="glass" type="submit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<button class="glass" href="{{ url_for('main.index') }}">Back to Home</button>
|
||||
|
||||
{% endblock %}
|
|
@ -1,69 +1,104 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{ filename }} - Markdown Viewer</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/digitallytailored/classless@latest/classless.min.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!--<link rel="stylesheet" href="github-markdown.css">-->
|
||||
<style>
|
||||
pre {
|
||||
background-color: #f5f5f5;
|
||||
padding: 1em;
|
||||
border-radius: 4px;
|
||||
overflow-x: auto;
|
||||
{% extends "base.html" %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- This supports light and dark mode automatically. -->
|
||||
<link rel="stylesheet" href="https://esm.sh/@wooorm/starry-night@3/style/both">
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
<!-- <style>
|
||||
.markdown-body {
|
||||
box-sizing: border-box;
|
||||
min-width: 200px;
|
||||
max-width: 980px;
|
||||
margin: 0 auto;
|
||||
padding: 45px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.markdown-body {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
table, th, td {
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 0.5em;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.document-info {
|
||||
margin-bottom: 2em;
|
||||
padding: 1em;
|
||||
background-color: #f9f9f9;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.markdown-body {
|
||||
box-sizing: border-box;
|
||||
min-width: 200px;
|
||||
max-width: 980px;
|
||||
margin: 0 auto;
|
||||
padding: 45px;
|
||||
}
|
||||
|
||||
/* GitHub-style admonitions */
|
||||
.markdown-alert {
|
||||
padding: 0.5rem 1rem;
|
||||
margin-bottom: 16px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.markdown-alert-title {
|
||||
font-weight: 600;
|
||||
margin-bottom: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.markdown-alert-title svg {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.markdown-alert-note {
|
||||
border-left: 4px solid #0969da;
|
||||
background-color: #ddf4ff;
|
||||
}
|
||||
|
||||
.markdown-alert-tip {
|
||||
border-left: 4px solid #1a7f37;
|
||||
background-color: #dafbe1;
|
||||
}
|
||||
|
||||
.markdown-alert-important {
|
||||
border-left: 4px solid #9a6700;
|
||||
background-color: #fff8c5;
|
||||
}
|
||||
|
||||
.markdown-alert-warning {
|
||||
border-left: 4px solid #9a6700;
|
||||
background-color: #fff8c5;
|
||||
}
|
||||
|
||||
.markdown-alert-caution {
|
||||
border-left: 4px solid #cf222e;
|
||||
background-color: #ffebe9;
|
||||
}
|
||||
|
||||
/* Dark mode support */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.markdown-alert-note {
|
||||
background-color: rgba(56, 139, 253, 0.15);
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.markdown-body {
|
||||
padding: 15px;
|
||||
}
|
||||
} </style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document-info">
|
||||
<h1>{{ filename }}</h1>
|
||||
<p>
|
||||
<strong>Permanent Link:</strong>
|
||||
<code>{{ url_for('main.view_file', uri=uri, _external=True) }}</code>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
{{ content|safe }}
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<a href="{{ url_for('main.upload_file') }}">Upload Another Document</a> |
|
||||
<a href="{{ url_for('main.index') }}">Home</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
.markdown-alert-tip {
|
||||
background-color: rgba(46, 160, 67, 0.15);
|
||||
}
|
||||
|
||||
.markdown-alert-important,
|
||||
.markdown-alert-warning {
|
||||
background-color: rgba(187, 128, 9, 0.15);
|
||||
}
|
||||
|
||||
.markdown-alert-caution {
|
||||
background-color: rgba(248, 81, 73, 0.15);
|
||||
}
|
||||
}
|
||||
</style> -->
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="markdown-body">
|
||||
<h1>{{ filename }}</h1>
|
||||
<p>
|
||||
<strong>Permanent Link:</strong>
|
||||
<code>{{ url_for('main.view_file', uri=uri, _external=True) }}</code>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="markdown-body">
|
||||
{{ content|safe }}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button class="glass" href="{{ url_for('main.upload_file') }}">Upload Another Document</button>
|
||||
<!-- <button class="glass" href="{{ url_for('main.index') }}">Home</button> -->
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue