parent
515e77b0f4
commit
8b1afc7e3a
@ -36,6 +36,7 @@ export function convertMathjax(
|
|||||||
nightMode: boolean,
|
nightMode: boolean,
|
||||||
fontSize: number,
|
fontSize: number,
|
||||||
): [string, string] {
|
): [string, string] {
|
||||||
|
input = revealClozeAnswers(input);
|
||||||
const style = getStyle(getCSS(nightMode, fontSize));
|
const style = getStyle(getCSS(nightMode, fontSize));
|
||||||
|
|
||||||
if (input.trim().length === 0) {
|
if (input.trim().length === 0) {
|
||||||
@ -78,3 +79,9 @@ export function escapeSomeEntities(value: string): string {
|
|||||||
export function unescapeSomeEntities(value: string): string {
|
export function unescapeSomeEntities(value: string): string {
|
||||||
return value.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
return value.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function revealClozeAnswers(input: string): string {
|
||||||
|
// one-line version of regex in cloze.rs
|
||||||
|
const regex = /\{\{c(\d+)::(.*?)(?:::(.*?))?\}\}/gis;
|
||||||
|
return input.replace(regex, "[$2]");
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user