diff --git a/src/oj/learn/components/ExerciseFill.vue b/src/oj/learn/components/ExerciseFill.vue index ccb1608..15fceae 100644 --- a/src/oj/learn/components/ExerciseFill.vue +++ b/src/oj/learn/components/ExerciseFill.vue @@ -8,6 +8,13 @@ hljs.registerLanguage("python", python) hljs.registerLanguage("c", c) const props = defineProps<{ exercise: Exercise; lang?: string }>() + +function renderInlineCode(s: string): string { + return s.replace( + /`([^`]+)`/g, + (_, code) => `${code.replace(//g, '>')}`, + ) +} const data = computed(() => props.exercise.data as ExerciseFillData) type CodeSeg = { type: "code"; html: string } @@ -94,11 +101,12 @@ function inputWidth(idx: number): string { > -

{{ data.question }}

+

()
+
+function renderInlineCode(s: string): string {
+  return s.replace(
+    /`([^`]+)`/g,
+    (_, code) => `${code.replace(//g, '>')}`,
+  )
+}
 const data = computed(() => props.exercise.data as ExerciseMcqData)
 const isSingle = computed(() => data.value.answer.length === 1)
 
@@ -74,7 +81,7 @@ function optionType(idx: number): "default" | "primary" | "success" {
       
     
 
-    

{{ data.question }}

+

- {{ opt }} + diff --git a/src/oj/learn/components/ExerciseSort.vue b/src/oj/learn/components/ExerciseSort.vue index eaf2697..2da364f 100644 --- a/src/oj/learn/components/ExerciseSort.vue +++ b/src/oj/learn/components/ExerciseSort.vue @@ -8,6 +8,13 @@ hljs.registerLanguage("python", python) hljs.registerLanguage("c", c) const props = defineProps<{ exercise: Exercise; lang?: string }>() + +function renderInlineCode(s: string): string { + return s.replace( + /`([^`]+)`/g, + (_, code) => `${code.replace(//g, '>')}`, + ) +} const data = computed(() => props.exercise.data as ExerciseSortData) type LineItem = { originalIdx: number; text: string } @@ -110,7 +117,7 @@ const lineHtmlMap = computed>(() => { > -

{{ data.question }}

+