File tree Expand file tree Collapse file tree 10 files changed +7663
-6
lines changed Expand file tree Collapse file tree 10 files changed +7663
-6
lines changed Original file line number Diff line number Diff line change 2020 < body >
2121 {{content-for "body"}}
2222
23+ < link rel ="stylesheet " href ="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.min.css " integrity ="sha384-9eLZqc9ds8eNjO3TmqPeYcDj8n+Qfa4nuSiGYa6DjLNcv9BtN69ZIulL9+8CqC9Y " crossorigin ="anonymous ">
24+
2325 < script src ="{{rootURL}}assets/vendor.js "> </ script >
2426 < script src ="{{rootURL}}assets/trouble-maker-frontend.js "> </ script >
2527
2628 {{content-for "body-footer"}}
29+
30+
2731 </ body >
2832</ html >
Original file line number Diff line number Diff line change 1+
2+ import showdown from 'showdown' ;
3+
4+ export function initialize ( ) {
5+ // register showdownKatex as "katex" extension
6+ showdown . extension ( "katex" , showdownKatex ( ) ) ;
7+ }
8+
9+ export default {
10+ initialize
11+ } ;
Original file line number Diff line number Diff line change 99 <h3 > {{ input type =" text" class =" input-text" value =choice.title }} </h3 >
1010 </div >
1111 <div class =" col-5" >
12- {{ markdown-to-html choice.title }}
12+ {{ markdown-to-html choice.title extensions = ' katex ' }}
1313 </div >
1414 </div >
1515 <div class =" row justify-content-center align-items-center" >
2222 </p >
2323 </div >
2424 <div class =" col-5" >
25- {{ markdown-to-html choice.description }}
25+ {{ markdown-to-html choice.description extensions = ' katex ' }}
2626 </div >
2727 </div >
2828 {{ else }}
Original file line number Diff line number Diff line change 1414 {{ input type =" text" class =" input-text" value =question.title }}
1515 </div >
1616 <div class =" col-5" >
17- {{ markdown-to-html question.title }}
17+ {{ markdown-to-html question.title extensions = ' katex ' }}
1818 </div >
1919 </div >
2020
2626 {{ textarea type =" text" class =" input-text py-4" value =question.description }}
2727 </div >
2828 <div class =" col-5" >
29- {{ markdown-to-html question.description }}
29+ {{ markdown-to-html question.description extensions = ' katex ' }}
3030 </div >
3131 </div >
3232
Original file line number Diff line number Diff line change 2424 {{ textarea type =" text" class =" input-text py-4" value =quiz.description }}
2525 </div >
2626 <div class =" col-3" >
27- {{ markdown-to-html quiz.description }}
27+ {{ markdown-to-html quiz.description extensions = ' katex ' }}
2828 </div >
2929 </div >
3030 {{ #unless quiz.isNew }}
Original file line number Diff line number Diff line change @@ -20,5 +20,6 @@ module.exports = function(defaults) {
2020 // please specify an object with the list of modules as keys
2121 // along with the exports of each module as its value.
2222 app . import ( 'node_modules/@coding-blocks/motley/dist/app.min.css' )
23+ app . import ( 'node_modules/showdown-katex-studdown/dist/showdown-katex.js' )
2324 return app . toTree ( ) ;
2425} ;
Original file line number Diff line number Diff line change 6060 "ember-confirm-dialog" : " ^1.2.1" ,
6161 "ember-modal-dialog" : " ^3.0.0-beta.0" ,
6262 "ember-simple-auth" : " ^1.6.0" ,
63- "ember-simple-auth-token" : " ^4.0.3"
63+ "ember-simple-auth-token" : " ^4.0.3" ,
64+ "showdown-katex-studdown" : " ^0.4.0"
6465 }
6566}
Original file line number Diff line number Diff line change 1+ import { module , test } from 'qunit' ;
2+ import { setupRenderingTest } from 'ember-qunit' ;
3+ import { render } from '@ember/test-helpers' ;
4+ import hbs from 'htmlbars-inline-precompile' ;
5+
6+ module ( 'Integration | Helper | render-katex' , function ( hooks ) {
7+ setupRenderingTest ( hooks ) ;
8+
9+ // Replace this with your real tests.
10+ test ( 'it renders' , async function ( assert ) {
11+ this . set ( 'inputValue' , '1234' ) ;
12+
13+ await render ( hbs `{{render-katex inputValue}}` ) ;
14+
15+ assert . equal ( this . element . textContent . trim ( ) , '1234' ) ;
16+ } ) ;
17+ } ) ;
Original file line number Diff line number Diff line change 1+ import Application from '@ember/application' ;
2+
3+ import { initialize } from 'trouble-maker-frontend/initializers/register-katex-showdown' ;
4+ import { module , test } from 'qunit' ;
5+ import { setupTest } from 'ember-qunit' ;
6+ import { run } from '@ember/runloop' ;
7+
8+ module ( 'Unit | Initializer | register-katex-showdown' , function ( hooks ) {
9+ setupTest ( hooks ) ;
10+
11+ hooks . beforeEach ( function ( ) {
12+ this . TestApplication = Application . extend ( ) ;
13+ this . TestApplication . initializer ( {
14+ name : 'initializer under test' ,
15+ initialize
16+ } ) ;
17+
18+ this . application = this . TestApplication . create ( { autoboot : false } ) ;
19+ } ) ;
20+
21+ hooks . afterEach ( function ( ) {
22+ run ( this . application , 'destroy' ) ;
23+ } ) ;
24+
25+ // Replace this with your real tests.
26+ test ( 'it works' , async function ( assert ) {
27+ await this . application . boot ( ) ;
28+
29+ assert . ok ( true ) ;
30+ } ) ;
31+ } ) ;
You can’t perform that action at this time.
0 commit comments