-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Locked Figures] Use $ symbols to denote TeX within locked labels and locked figure labels #1834
Conversation
… locked figure labels
… locked figure labels
} | ||
|
||
return result; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried doing some regex stuff along with mathString.replace()
but it got convoluted and kept letting edge cases slip through the cracks. I decided to go back to basics and stick to what works, and this was the resulting code.
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (6bd18fb) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1834 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1834 |
Size Change: +393 B (+0.05%) Total Size: 859 kB
ℹ️ View Unchanged
|
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
@@ -65,3 +65,58 @@ describe("normalizeCoords", () => { | |||
expect(result).toEqual(expected); | |||
}); | |||
}); | |||
|
|||
describe("replaceOutsideTeX", () => { | |||
test("no $s", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these tests do the same thing, using a table might make things easier since you won't need to redo the code for each test, just have a table of inputs
https://jestjs.io/docs/api#2-testeachtablename-fn-timeout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that, but I wanted the description of each test to be explicit!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I think the table would get really long with some of the descriptions + math strings. It would definitely be fewer lines, but I think I prefer the deliberateness of having them be separate tests in this particular case.
Co-authored-by: anakaren-rojas <[email protected]>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @khanacademy/[email protected] ### Minor Changes - [#1834](#1834) [`429b9cc15`](429b9cc) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figures] Use \\$ symbols to denote TeX within locked labels and locked figure labels ### Patch Changes - [#1833](#1833) [`122b3cc1b`](122b3cc) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Removal of unused MathJax2 initialization ## @khanacademy/[email protected] ### Minor Changes - [#1834](#1834) [`429b9cc15`](429b9cc) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figures] Use \\$ symbols to denote TeX within locked labels and locked figure labels ### Patch Changes - Updated dependencies \[[`429b9cc15`](429b9cc), [`122b3cc1b`](122b3cc)]: - @khanacademy/[email protected]
Summary:
In the rest of the exercise editor, content authors need to surround text in
$
for it to be denoted as TeX.For consistency, we want to add that functionality to the interactive graph editor as well.
wrapping the whole thing in
Note: This is a prerequisite for auto-generating spoken math details with the MathJax speech engine
for the aria labels, because the non-TeX text needs to be differentiated in the label for the label
to be generated correctly for non-TeX text. If it's all TeX, the speech engine reads every letter
separately (example: "square A" ==> "s q u a r e upper A")
Issue: https://khanacademy.atlassian.net/browse/LEMS-2548
Test plan:
yarn jest packages/perseus/src/widgets/interactive-graphs/utils.test.ts
Storybook