mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
parent
515e77b0f4
commit
8b1afc7e3a
1 changed files with 7 additions and 0 deletions
|
@ -36,6 +36,7 @@ export function convertMathjax(
|
|||
nightMode: boolean,
|
||||
fontSize: number,
|
||||
): [string, string] {
|
||||
input = revealClozeAnswers(input);
|
||||
const style = getStyle(getCSS(nightMode, fontSize));
|
||||
|
||||
if (input.trim().length === 0) {
|
||||
|
@ -78,3 +79,9 @@ export function escapeSomeEntities(value: string): string {
|
|||
export function unescapeSomeEntities(value: string): string {
|
||||
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 a new issue