Remove markdown

I can't take it.
This commit is contained in:
MatthiasSaihttam 2021-10-14 12:45:09 -04:00
parent 1411762ca1
commit 5dd070b043
3 changed files with 8 additions and 51 deletions

View File

@ -102,6 +102,7 @@ textarea::placeholder, input[type="text"]::placeholder {
.text, .thought-end {
max-width: 100%;
line-height: 1.5em;
font-family: inherit;
}
.main-text, .main-text p:last-child {

View File

@ -32,19 +32,18 @@
{% endif %}
{% load tz %}
{% load markdown %}
{% for thought in thoughts %}
<div class="thought{% if thought.uuid == highlighted %} highlighted{% endif %}" id="{{ thought.uuid }}">
<div class="main">
<span class="main-text text">{{ thought.text|markdown }}</span>
<pre class="main-text text">{{ thought.text }}</pre>
</div>
{% with file_type=thought.get_media_type %}
{% if file_type or thought.extended_text.strip %}
<div class="extended">
{% if thought.extended_text.strip %}
<span class="extended-text text">{{ thought.extended_text|markdown }}</span>
<pre class="extended-text text">{{ thought.extended_text }}</pre>
{% endif %}
{% if file_type == "png" or file_type == "jpeg" %}
<img src="{{ thought.media.url }}" class="extended-media" alt="{{ thought.media_alt }}">
@ -125,52 +124,4 @@
}
}
</script>
{# <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.2.0/build/styles/tomorrow-night.min.css">#}
{# <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.2.0/build/highlight.min.js"></script>#}
<!--Remarkable UMD bundle, includes linkify and Remarkable in the global remarkable-->
<script src="https://cdn.jsdelivr.net/npm/remarkable@2.0.1/dist/remarkable.min.js"></script>
<script>
// Remarkable ES6 module
// import { Remarkable } from "https://cdn.jsdelivr.net/npm/remarkable@2.0.1/dist/esm/index.browser.min.js";
// import { linkify } from "https://cdn.jsdelivr.net/npm/remarkable@2.0.1/dist/esm/linkify.js";
/*const md = new remarkable.Remarkable({
html: false, breaks: true, typographer: true,
highlight: function (str, lang) {
if (lang && hljs.getLanguage(lang)) {
return hljs.highlight(lang, str).value;
}
return hljs.highlightAuto(str).value;
}
}).use(remarkable.linkify);
// I'm leaving in "references", which handles the convention of putting your links at the bottom of your post
md.core.ruler.disable(["abbr", "abbr2", "footnote_tail", "replacements"]);
md.block.ruler.disable(["hr", "footnote", "heading", "lheading", "table", "htmlblock"]);
md.inline.ruler.disable(["del", "ins", "mark", "sub", "sup", "footnote_inline", "footnote_ref", "htmltag", "entity", "autolink"]);
//Images are parsed as inline links, so we can't turn off parsing,
//but we can overwrite the renderer so they never get displayed. Not ideal
/*md.renderer.rules.image = function () {
return "";
};*/
/*
for (let el of els) {
const extendedText = el.querySelector(".extended-text");
const mainText = el.querySelector(".main-text");
//Markdown + highlight
mainText.innerHTML = md.render(mainText.textContent);
if (extendedText) {
extendedText.innerHTML = md.render(extendedText.textContent);
}
}
*/
</script>
{% endblock %}

View File

@ -20,3 +20,8 @@ def markdown(value, autoescape=True):
# html = value
md.reset()
return html
@register.filter(needs_autoescape=True)
def nl_br(value, autoescape=True):
html = mark_safe(value.replace("\n", "<br>"))
return html