diff --git a/client/src/__tests__/components/GiftTemplate/TextType.test.ts b/client/src/__tests__/components/GiftTemplate/TextType.test.ts index e185470..8806854 100644 --- a/client/src/__tests__/components/GiftTemplate/TextType.test.ts +++ b/client/src/__tests__/components/GiftTemplate/TextType.test.ts @@ -100,4 +100,12 @@ describe('TextType', () => { }); // Add more tests for other formats if needed + it('should format a resized image correctly', () => { + const input: TextFormat = { + text: '![](https\\://www.etsmtl.ca/assets/img/ets.svg "\\=50px")', + format: 'markdown' + }; + const expectedOutput = '\n'; + expect(FormattedTextTemplate(input)).toBe(expectedOutput); + }); }); diff --git a/client/src/components/GiftTemplate/templates/MultipleChoiceAnswersTemplate.ts b/client/src/components/GiftTemplate/templates/MultipleChoiceAnswersTemplate.ts index 2b7d86b..2bc423d 100644 --- a/client/src/components/GiftTemplate/templates/MultipleChoiceAnswersTemplate.ts +++ b/client/src/components/GiftTemplate/templates/MultipleChoiceAnswersTemplate.ts @@ -55,35 +55,9 @@ export default function MultipleChoiceAnswersTemplate({ choices }: MultipleChoic } function AnswerWeight({ weight }: AnswerWeightOptions): string { - // const Container = ` - // box-shadow: 0px 1px 1px ${theme(state.theme, 'gray400', 'black900')}; - // border-radius: 3px; - // padding-left: 0.2rem; - // padding-right: 0.2rem; - // padding-top: 0.05rem; - // padding-bottom: 0.05rem; - // `; - - // const CorrectWeight = ` - // color: ${theme(state.theme, 'green700', 'green100')}; - // background-color: ${theme(state.theme, 'green100', 'greenGray700')}; - // `; - // const IncorrectWeight = ` - // color: ${theme(state.theme, 'beige600', 'beige100')}; - // background-color: ${theme(state.theme, 'beige300', 'beigeGray800')}; - // `; - return weight ? `${weight}%` : ``; - // ? `${weight}%` - // : ``; } function AnswerFeedback({ formattedFeedback }: AnswerFeedbackOptions): string { - // const Container = ` - // color: ${theme(state.theme, 'teal700', 'gray700')}; - // `; - return formattedFeedback ? `${FormattedTextTemplate(formattedFeedback)}` : ``; } diff --git a/client/src/components/GiftTemplate/templates/TextTypeTemplate.ts b/client/src/components/GiftTemplate/templates/TextTypeTemplate.ts index 3c17ad6..154f59f 100644 --- a/client/src/components/GiftTemplate/templates/TextTypeTemplate.ts +++ b/client/src/components/GiftTemplate/templates/TextTypeTemplate.ts @@ -1,4 +1,3 @@ -// import { marked } from 'marked'; import marked from 'src/markedConfig'; import katex from 'katex'; diff --git a/client/src/markedConfig.ts b/client/src/markedConfig.ts index 3abbf0b..29a9d9a 100644 --- a/client/src/markedConfig.ts +++ b/client/src/markedConfig.ts @@ -1,5 +1,7 @@ import { marked, Renderer } from 'marked'; +// Customized renderer to support image width and height +// see https://github.com/markedjs/marked/issues/339#issuecomment-1146363560 const renderer = new Renderer(); renderer.image = ({href, title, text}) => {