1
0
mirror of https://github.com/GenderDysphoria/GenderDysphoria.fyi.git synced 2025-11-25 12:32:42 +00:00

Changing fencing on html blocks

Because *someone* had to use three pipes in their twitter display name
This commit is contained in:
Jocelyn Badgley (Twipped)
2020-03-06 19:30:48 -08:00
parent 6ae8f358a4
commit b9f82a7018
3 changed files with 8 additions and 7 deletions

View File

@@ -31,7 +31,7 @@ const markdownEngines = {
permalinkSymbol: '<img src="/images/svg/paragraph.svg">',
slugify,
})
.use(require('./lib/markdown-raw-html')),
.use(require('./lib/markdown-raw-html'), { debug: false }),
preview: markdownIt({
html: false,
@@ -45,7 +45,7 @@ function markdown (mode, input, env) {
input = input.replace(/\{!\{([\s\S]*?)\}!\}/mg, (match, contents) => {
try {
const result = handlebars.compile(contents)(env);
return '|||' + result + '|||';
return 'æææ' + result + 'æææ';
} catch (e) {
log.error(e);
return '';
@@ -55,7 +55,7 @@ function markdown (mode, input, env) {
if (mode === 'preview') {
input = striptags(input
.replace(/<!--\[[\s\S]*?\]-->/g, '')
.replace(/|||[\s\S]*?|||/gi, ''),
.replace(/æææ[\s\S]*?æææ/gi, ''),
).trim();
if (input.length > 1000) input = input.slice(0, 1000) + '…';
input = input ? markdownEngines[mode].render(input) : '';

View File

@@ -2,7 +2,7 @@
module.exports = exports = function (md, options) {
options = {
fence: '|||',
fence: 'æææ',
...options,
};
@@ -58,7 +58,8 @@ module.exports = exports = function (md, options) {
}
if (startLine > state.discreteHtmlScan.line) {
// we dun fucked up
// we dun fucked up, rescan
scanAhead(state, startLine, pos);
debug('We somehow got ahead of ourselves', { startLine, line: state.discreteHtmlScan.line, lastLine, pos, endOfLine, tokens: state.tokens });
throw new Error('markdown-it-discrete-html encountered a parsing error.');
}