Mathjax single dollar sign delimiter configuration causes unintentional math rendering in abstracts

Open Beginner friendly
#6,263 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
angular, typescript
Domain
frontend

Research direction

Start with src/app/core/shared/client-math.service.ts, specifically the MathJax delimiter configuration linked in the issue, and check how the UI configuration currently enables MathJax. Reproduce using an abstract containing two dollar signs, then verify the text is no longer unintentionally rendered as math while the other delimiters still work; the issue names no test file.

Written by the indexing model from the issue text.

Description

bug needs triage

Describe the bug

The current mathjax configuration provided in client-math.service.ts configures mathjax to use a number of delimiters to denote a math formula for rendering. At the moment, a single dollar sign ($) is one option that is configured by default as a delimiter. This default configuration causes issues when mathjax is enabled and an abstract uses any two dollar signs anywhere in the metadata field, creating instances where content is inadvertently rendered as formula.

To Reproduce

Steps to reproduce the behavior:

  1. Enable mathjax in your UI configuration file
  2. Create a new item or edit an existing item, providing the following in the dc.description.abstract metadata field:
    Last Sunday I bought an ice cream cone for $2. Then we went to the market down the road and they were selling their ice cream cones for $3! What a terrible thing!.
  3. View your item and note that all the text between the two dollar signs has been interpreted as a mathematical formula.

Expected behaviour

In my opinion, the single dollar sign delimiter is too easy to use unintentionally and should be disabled. There are still two other delimiters that users could use to insert a formula in a more intentional way.

Alternatively, it would be nice for site admins to be able to pass in delimiter configuration as part of your dspace-angular configuration to allow us to override this behaviour without needing to maintain a local customization of the code.

I experienced this on DSpace 8, but the mathjax configuration seems the same in all the other versions as well.

Thanks!
-Adam

Dominant language
TypeScript
Stars
180
Forks
577
Avg merge
2d 18h
Merged PRs (30d)
115

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DSpace/dspace-angular

All issues in DSpace/dspace-angular

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.