change code blocks to [code][/code], try not to interfere with sjis as much reference #278

merge-requests/208/head
Thomas Lynch 4 years ago
parent bc44b0529c
commit c2e7699b15
  1. 2
      gulp/res/css/style.css
  2. 6
      helpers/posting/markdown.js
  3. 27
      views/custompages/faq.pug.example

@ -116,7 +116,7 @@ pre {
white-space: pre;
}
.code.aa {
.aa {
font-family: Monapo, Mona, 'MS Pgothic', 'MS P繧エ繧キ繝<EFBFBD>け', IPAMonaPGothic, 'IPA 繝「繝翫<EFBFBD> P繧エ繧キ繝<EFBFBD>け', submona !important;
font-size: 16px;
}

@ -12,8 +12,8 @@ const greentextRegex = /^&gt;((?!&gt;\d+|&gt;&gt;&#x2F;\w+(&#x2F;\d*)?).*)/gm
, detectedRegex = /(\(\(\(.+?\)\)\))/gm
, linkRegex = /https?\:&#x2F;&#x2F;[^\s<>\[\]{}|\\^]+/g
, codeRegex = /(?:(?<language>[a-z+]{1,10})\r?\n)?(?<code>[\s\S]+)/i
, includeSplitRegex = /(```[\s\S]+?```)/gm
, splitRegex = /```([\s\S]+?)```/gm
, includeSplitRegex = /(\[code\][\s\S]+?\[\/code\])/gm
, splitRegex = /\[code\]([\s\S]+?)\[\/code\]/gm
, trimNewlineRegex = /^\s*(\r?\n)*|(\r?\n)*$/g
, getDomain = (string) => string.split(/\/\/|\//)[1] //unused atm
, escape = require(__dirname+'/escape.js')
@ -83,7 +83,7 @@ module.exports = {
const { value } = highlight(lang, trimFix, true);
return `<span class='code hljs'><small>language: ${lang}</small>\n${value}</span>`;
} else if (lang === 'aa') {
return `<span class='code aa'>${escape(matches.groups.code)}</span>`;
return `<span class='aa'>${escape(matches.groups.code)}</span>`;
}
return `<span class='code'>${escape(trimFix)}</span>`;
},

@ -152,6 +152,14 @@ block content
td (((detected)))
td
span.detected (((detected)))
tr
td
| [aa]∧_∧
| ( ・ω・) Let's try that again.[&#x2F;aa]
td
pre.aa
| ∧_∧
| ( ・ω・) Let's try that again.
tr
td ##2d9+3
td
@ -175,13 +183,24 @@ block content
span.mono inline monospace
tr
td
| ```language
| [code]language
br
| code block
| int main() {...}
br
| ```
| [/code]
td
span.code int main() {...}
tr
td
pre
| [code]aa
| ∧_∧
| ( ・ω・) Let's try that again.
| [&#x2F;code]
td
span.code code block
pre.aa
| ∧_∧
| ( ・ω・) Let's try that again.
tr
td(colspan=2)
| The "language" of code blocks is optional. Without it, automatic language detection is used.

Loading…
Cancel
Save