Skip to content

Commit

Permalink
Use common directive options for solution directive
Browse files Browse the repository at this point in the history
  • Loading branch information
fwkoch committed Nov 20, 2024
1 parent ed4e864 commit 826df5b
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions packages/myst-ext-exercise/src/exercise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,7 @@ export const solutionDirective: DirectiveSpec = {
required: true,
},
options: {
label: {
type: String,
},
class: {
type: String,
},
...commonDirectiveOptions('solution'),
hidden: {
type: Boolean,
},
Expand All @@ -99,16 +94,12 @@ export const solutionDirective: DirectiveSpec = {
if (data.body) {
children.push(...(data.body as GenericNode[]));
}
const rawLabel = data.options?.label as string;
const { label, identifier } = normalizeLabel(rawLabel) || {};
const solution: GenericNode = {
type: 'solution',
label,
identifier,
class: data.options?.class as string,
hidden: data.options?.hidden as boolean,
children: children as any[],
};
addCommonDirectiveOptions(data, solution);
if (data.name.endsWith('-start')) {
solution.gate = 'start';
}
Expand Down

0 comments on commit 826df5b

Please sign in to comment.