fixed up serverside scripts

This commit is contained in:
Ellpeck 2019-10-10 00:30:46 +02:00
parent 175202554d
commit 19d9b2b492
6 changed files with 7 additions and 16 deletions

View file

@ -27,11 +27,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/showdown@1.9.0/dist/showdown.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/prettify.js"></script>
<script src="shared/showdown-prettify.js"></script>
<script src="shared/showdown-footnotes.js"></script>
<script src="scripts/main.js"></script>
</head>

View file

@ -4,8 +4,8 @@ const {
const fs = require("fs");
const showdown = require("showdown");
require("../shared/showdown-prettify");
require("../shared/showdown-footnotes");
require("./showdown-prettify");
require("./showdown-footnotes");
const converter = new showdown.Converter({
parseImgDimensions: true,
headerLevelStart: 3,

View file

@ -4,8 +4,8 @@ const {
const fs = require("fs");
const showdown = require("showdown");
require("../shared/showdown-prettify");
require("../shared/showdown-footnotes");
require("./showdown-prettify");
require("./showdown-footnotes");
const converter = new showdown.Converter({
parseImgDimensions: true,
extensions: ["prettify", "footnotes"]

View file

@ -20,7 +20,7 @@
return [{
type: 'lang',
filter: function filter(text) {
return text.replace(/^\[\^([\d\w]+)\]:\s*((\n+(\s{2,4}|\t).+)+)$/mg, function (str, name, rawContent, _, padding) {
return text.replace(/^\[\^([\d\w]+)\]:\s*((\n+(\s{2,4}|\t).+)+)$/mgi, function (str, name, rawContent, _, padding) {
var content = converter.makeHtml(rawContent.replace(new RegExp('^' + padding, 'gm'), ''));
return '<a class="blog-anchor" id="footnote-' + name + '"></a><div class="footnote">[' + name + ']:' + content + '</div>';
});
@ -28,14 +28,14 @@
}, {
type: 'lang',
filter: function filter(text) {
return text.replace(/^\[\^([\d\w]+)\]:( |\n)((.+\n)*.+)$/mg, function (str, name, _, content) {
return text.replace(/^\[\^([\d\w]+)\]:( |\n)((.+\n)*.+)$/mgi, function (str, name, _, content) {
return '<a class="blog-anchor" id="footnote-' + name + '"></a><small class="footnote">[' + name + ']: ' + content + '</small>';
});
}
}, {
type: 'lang',
filter: function filter(text) {
return text.replace(/\[\^([\d\w]+)\]/m, function (str, name) {
return text.replace(/\[\^([\d\w]+)\]/mgi, function (str, name) {
return '<a href="#footnote-' + name + '"><sup>[' + name + ']</sup></a>';
});
}

View file

@ -1,8 +1,3 @@
let converter = new showdown.Converter({
parseImgDimensions: true,
headerLevelStart: 3,
extensions: ["prettify", "footnotes"]
});
$.ajax({
dataType: "json",
url: "blog/posts.json",