Go to file
Ed Schiebel 0fc8ce19f7 New approach to MathJax-ifying equations
closes LS-1601
flag=new_math_equation_handling

The previous approach was to replace the equation image with the
equation's LaTeX in canvas' backend, but not all user content sent
to the browser passes through UserContent.escape. Discussions
and legacy quiz questions included. The backend approach also suffered
from the an ugly visual where the LaTeX is displayed onscreen until
MathJax typesets it.

In a previous commit, I caught Discussion replies in apiUserContent
where the screenreader assistive mathml is injected into the DOM
adjacent to the image. That worked but we now had 2 places
where the replacement was taking place, and quiz questions are
still being missed.

A better approach is to handle it all in a central location, which
is with the code that detects math is on the page. The new approach
is to inject the LaTeX into the DOM adjacent to the image just before
MathJax does its processing, then removes the image when it finished.
This way the equation image is displayed to the user while MathJaX
does its work, and since we look for new math in a MutationObserver
watching the whole document, we never miss any equation images on the page.

Because we are looking for mutations anywhere on the page, there may
be nodes we want to ignore (e.g. the quiz timer). This is handled
by adding to the ignore_list css selector in main.js

test plan:
  - with the "Updated math equation handling" flag on
    (and optionally 'Support LaTex math equations almost everywhere")
  - double check that equations created with the rce equation editor
    are processed with mathjax all over canvas
  > expect equation images to be visible until replaced by MathJax
    typeset versions
  - Discussions:
    - reply to a discussion with an equation (inline and equation editor)
    > expect them to be typeset by mathjax
    - edit a reply and save
    > expect the the reply to have it's math processed by mathjax
  - Legacy Quizzes
    - create a quiz, set it so 1 question per page
    - add a couple questions with equations
    - preview the quiz, moving forward and back thru the questions
    > expect the questions go have their equations typeset by mathjax

Change-Id: I9e2ec4fd53de06748156bbd4adadac7e2b1e205f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/252222
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2020-11-09 22:38:36 +00:00
.github update github pr auto-assignees 2020-09-24 20:00:41 +00:00
Gemfile.d pin pact-support to latest working version 2020-11-04 18:54:37 +00:00
app New approach to MathJax-ifying equations 2020-11-09 22:38:36 +00:00
bin Update Contract Test Documentation 2020-10-19 21:58:45 +00:00
build retag instructure/ruby-passenger in case it has changed 2020-11-09 15:32:26 +00:00
client_apps remove example components 2020-11-09 21:52:01 +00:00
config update sv-x-k12 translation 2020-11-07 05:48:21 +00:00
db/migrate remove migration shims for auditors datastore 2020-11-09 16:30:30 +00:00
doc don't include group info when none exist 2020-11-05 17:35:29 +00:00
docker-compose add timeout parameter to wait-for-it script; refs DE-347 2020-10-30 18:04:45 +00:00
frontend_build add support for catalan (CA) locale 2020-09-02 15:49:02 +00:00
gems Ensure outcome reports use course level settings 2020-11-09 17:05:41 +00:00
hooks fix pre-commit hook with unfixable eslint error 2018-11-27 23:28:12 +00:00
jest Make type filter searchable on courses main list 2020-05-19 01:24:11 +00:00
lib New approach to MathJax-ifying equations 2020-11-09 22:38:36 +00:00
log Update parallel_runtime_rspec.log from build 104 2020-11-09 21:00:54 +00:00
packages [i18n] Update package translations 2020-11-07 04:48:33 +00:00
pact Include context_name in planner item response 2018-08-29 22:20:52 +00:00
public New approach to MathJax-ifying equations 2020-11-09 22:38:36 +00:00
script add docker-smoke build 2020-09-14 23:12:35 +00:00
spec New approach to MathJax-ifying equations 2020-11-09 22:38:36 +00:00
tmp Alpine canvas-lms based image 2020-07-15 17:21:56 +00:00
.bowerrc introduced bower to manage js dependencies 2013-12-13 17:45:57 +00:00
.codeclimate.yml disable ESLint in code climate 2017-02-14 17:47:39 +00:00
.dive-ci Spec: Add dive build 2020-03-26 14:52:06 +00:00
.dockerignore Alpine canvas-lms based image 2020-07-15 17:21:56 +00:00
.editorconfig Add EditorConfig configuration file to help maintain code style 2016-11-15 20:08:55 +00:00
.eslintignore Run prettier on packages/ 2019-10-11 19:29:16 +00:00
.eslintrc.js update build to load es modules from subpackages 2020-06-03 13:41:38 +00:00
.gitignore remove need for api_scope_mapper.rb to be committed 2020-11-06 17:50:59 +00:00
.gitmessage prepend some blank lines to .gitmessage 2019-08-09 16:12:53 +00:00
.i18nignore bump rails 3 to github branch for ruby 2.2 compatibility 2015-02-18 22:55:20 +00:00
.i18nrc upgrade to node 6 2016-08-09 23:37:07 +00:00
.lintstagedrc.js Remove prettier whitelist 2019-10-11 19:29:31 +00:00
.npmrc fix brand config previewing and skipping 2015-10-27 16:16:15 +00:00
.nvmrc require node 10.16 for brotli support 2020-04-03 19:48:37 +00:00
.prettierrc Add .prettierrc so it matches our existing code 2017-11-03 16:21:50 +00:00
.rubocop.yml enforce frozen_string_literal comment 2020-10-28 22:08:52 +00:00
.stylelintrc remove uses of whitelist and blacklist 2020-09-18 15:58:40 +00:00
.travis.yml more travis builds 2014-02-10 16:23:19 +00:00
CONTRIBUTING.md Add CLA FAQ from legal 2018-01-22 16:41:44 -05:00
COPYRIGHT Initial commit. 2011-01-31 18:57:29 -07:00
Dockerfile don’t install optional yarn dependencies 2020-10-22 22:05:19 +00:00
Dockerfile.githook Add precommit hook for auto fixing files 2018-11-27 21:07:31 +00:00
Dockerfile.jenkins enable rails 6 for testing 2020-10-23 14:49:00 +00:00
Dockerfile.jenkins-cache tighten config/ scope of webpack cache helper image 2020-10-22 13:58:44 +00:00
Dockerfile.package-translations Create shared translation infrastructure for packages 2019-11-06 22:42:03 +00:00
Gemfile drop rails 5.1 2019-08-01 14:09:31 +00:00
Jenkinsfile stable branches pull corresponding plugin stable branch 2020-11-09 19:34:59 +00:00
Jenkinsfile.cassandra move helper images into own build 2020-09-15 21:47:15 +00:00
Jenkinsfile.contract-tests abstract checkout code in jenkinsfiles 2020-11-04 20:58:00 +00:00
Jenkinsfile.dive protect against retriable errors in docker pull 2020-07-02 14:03:48 +00:00
Jenkinsfile.docker-smoke abstract checkout code in jenkinsfiles 2020-11-04 20:58:00 +00:00
Jenkinsfile.dynamodb move helper images into own build 2020-09-15 21:47:15 +00:00
Jenkinsfile.js abstract checkout code in jenkinsfiles 2020-11-04 20:58:00 +00:00
Jenkinsfile.master-bouncer-check-all use shared library for configuration 2020-06-18 18:36:49 +00:00
Jenkinsfile.package-translations use shared library for configuration 2020-06-18 18:36:49 +00:00
Jenkinsfile.parallel_logs move failure reports 2020-11-03 18:30:44 +00:00
Jenkinsfile.postgres move helper images into own build 2020-09-15 21:47:15 +00:00
Jenkinsfile.redis move helper images into own build 2020-09-15 21:47:15 +00:00
Jenkinsfile.selenium.flakey_spec_catcher fix FSC output archiving 2020-11-04 22:16:08 +00:00
Jenkinsfile.selenium.performance.chrome Send slack message on failure 2020-07-28 18:29:49 +00:00
Jenkinsfile.test-subbuild remove print-env-excluding-secrets 2020-08-12 20:49:03 +00:00
Jenkinsfile.vendored-gems abstract checkout code in jenkinsfiles 2020-11-04 20:58:00 +00:00
Jenkinsfile.xbrowser use shared library for configuration 2020-06-18 18:36:49 +00:00
LICENSE Initial commit. 2011-01-31 18:57:29 -07:00
README.md Update README.md since Canvas is still modern 2016-12-15 03:18:28 +00:00
Rakefile use parallel_tests for more parallelization 2020-03-30 21:38:47 +00:00
babel.config.js Fix the build 2019-09-17 21:26:07 +00:00
bower.json Move k5uplodaer to /packages 2019-05-10 18:30:51 +00:00
code_of_conduct.md contributor code of conduct 2014-12-23 18:13:59 +00:00
config.ru remove extra logging to debug Passenger connection orphan issue 2017-07-14 16:27:03 +00:00
docker-compose.new-jenkins-contract-tests.yml Push canvas-as-a-consumer http contracts to pact broker 2020-08-31 17:49:08 +00:00
docker-compose.new-jenkins-flakey-spec-catcher.yml update fsc to go into the plugin directory to do tests 2020-06-17 14:58:09 +00:00
docker-compose.new-jenkins-karma.yml Alpine canvas-lms based image 2020-07-15 17:21:56 +00:00
docker-compose.new-jenkins-package-translations.yml Create shared translation infrastructure for packages 2019-11-06 22:42:03 +00:00
docker-compose.new-jenkins-selenium.yml upgrade to latest release of selenium docker image 2020-06-30 11:40:30 +00:00
docker-compose.new-jenkins.canvas.yml Spec: add `init: true` to jenkins builds 2020-06-16 14:09:58 +00:00
docker-compose.new-jenkins.consumer.yml skip uglify js / source maps on pre-merge builds v2 2020-08-11 21:05:54 +00:00
docker-compose.new-jenkins.vendored-gems.yml Spec: add `init: true` to jenkins builds 2020-06-16 14:09:58 +00:00
docker-compose.new-jenkins.yml enable rails 6 for testing 2020-10-23 14:49:00 +00:00
docker-compose.spring.yml bump all docker-compose files to 2.3 2020-07-28 20:44:44 +00:00
docker-compose.yml build ruby image in docker_dev_setup 2020-07-28 18:23:47 +00:00
gulpfile.js add support for catalan (CA) locale 2020-09-02 15:49:02 +00:00
issue_template.md Update community urls to reflect platform move 2020-08-12 20:17:02 +00:00
jest.config.js add conference ui to calendar details page 2020-04-30 18:06:11 +00:00
karma.conf.js Allow forcing a failure in each JS stage 2020-01-20 21:18:25 +00:00
package.json convert group edit JQueryUI dialog to InstUI modal 2020-10-19 22:26:16 +00:00
ubuntu.development.Dockerfile genericize dockerfile writer 2020-08-10 17:13:40 +00:00
ubuntu.production.Dockerfile genericize dockerfile writer 2020-08-10 17:13:40 +00:00
webpack.config.js Opt our js build tooling dirs into prettier 2018-11-07 22:46:16 +00:00
webpack.test.config.js spec: split coffeescript job 2020-07-17 17:39:35 +00:00
yarn.lock create MessageDetailItem for new Canvas Inbox 2020-11-09 18:08:01 +00:00

README.md

Canvas LMS

Canvas is a modern, open-source LMS developed and maintained by Instructure Inc. It is released under the AGPLv3 license for use by anyone interested in learning more about or using learning management systems.

Please see our main wiki page for more information

Installation

Detailed instructions for installation and configuration of Canvas are provided on our wiki.