feat: Implement basic markdown rendering for post content and user-based visibility for private posts.
This commit is contained in:
@@ -8,10 +8,41 @@
|
||||
* {
|
||||
font-family: monospace !important;
|
||||
}
|
||||
|
||||
code {
|
||||
background-color: #f0f0f0;
|
||||
padding: 2px 4px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: #f8f8f8;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
overflow-x: auto;
|
||||
display: block;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
pre code {
|
||||
background-color: transparent;
|
||||
padding: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000" link="#0000EE" vlink="#551A8B" alink="#FF0000">
|
||||
<div style="text-align: right;">
|
||||
{% if let Some(u) = user %}
|
||||
Logged in as: <b>{{ u.username }}</b> | <form action="/__dungeon/logout" method="post" style="display: inline;">
|
||||
<input type="submit" value="Logout">
|
||||
</form>
|
||||
{% else %}
|
||||
Not logged in | <a href="/__dungeon/login">Login</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<p><a href="/">[Back to Home]</a></p>
|
||||
<hr size="1">
|
||||
|
||||
@@ -28,15 +59,12 @@
|
||||
{% if post.visibility == "password_protected" %}
|
||||
<p><b>[This post is password protected. In a full implementation, you'd enter a password here.]</b></p>
|
||||
<hr size="1">
|
||||
{% else if post.visibility == "private" %}
|
||||
{% else if post.visibility == "private" && user.is_none() %}
|
||||
<p><b>[This post is private and only visible to authorized users.]</b></p>
|
||||
<hr size="1">
|
||||
{% else %}
|
||||
<hr size="1">
|
||||
<!-- Assuming content is plain text with newlines -->
|
||||
<p>
|
||||
<pre>{{ post.content|safe }}</pre>
|
||||
</p>
|
||||
{{ post.rendered_content()|safe }}
|
||||
<hr size="1">
|
||||
{% endif %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user