Unsere GitLab-Installation wurde aktualisiert (Informationen zu den Neuerungen).

Add experimental marked version for inline mathjax parsing.

parent 231ec1ae
Pipeline #11016 passed with stages
in 3 minutes and 11 seconds
This diff is collapsed.
......@@ -28,16 +28,16 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^5.0.3",
"@angular/common": "^5.0.3",
"@angular/compiler": "^5.0.3",
"@angular/core": "^5.0.3",
"@angular/forms": "^5.0.3",
"@angular/http": "^5.0.3",
"@angular/platform-browser": "^5.0.3",
"@angular/platform-browser-dynamic": "^5.0.3",
"@angular/router": "^5.0.3",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.5",
"@angular/animations": "^5.0.5",
"@angular/common": "^5.0.5",
"@angular/compiler": "^5.0.5",
"@angular/core": "^5.0.5",
"@angular/forms": "^5.0.5",
"@angular/http": "^5.0.5",
"@angular/platform-browser": "^5.0.5",
"@angular/platform-browser-dynamic": "^5.0.5",
"@angular/router": "^5.0.5",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.6",
"@ngx-translate/core": "^8.0.0",
"@ngx-translate/http-loader": "^2.0.0",
"@techiediaries/ngx-qrcode": "0.0.5",
......@@ -46,21 +46,21 @@
"highlight.js": "^9.12.0",
"intro.js": "^2.8.0-alpha.1",
"jquery": "^3.2.1",
"marked": "^0.3.6",
"marked": "git+https://github.com/trayhem/marked.git",
"messageformat": "^1.1.0",
"ngx-qrcode2": "0.0.5",
"ngx-translate-messageformat-compiler": "^2.0.1",
"popper.js": "^1.13.0",
"rxjs": "^5.5.2",
"rxjs": "^5.5.4",
"zone.js": "^0.8.18"
},
"devDependencies": {
"@angular/cli": "^1.5.4",
"@angular/compiler-cli": "^5.0.3",
"@angular/language-service": "^5.0.3",
"@angular/cli": "^1.5.5",
"@angular/compiler-cli": "^5.0.5",
"@angular/language-service": "^5.0.5",
"@types/jasmine": "^2.8.2",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^8.0.53",
"@types/node": "^8.0.55",
"arsnova-click-v2-types": "git+https://git.thm.de/arsnova/arsnova-click-v2-types.git",
"codelyzer": "~4.0.1",
"http-server": "^0.10.0",
......@@ -71,7 +71,7 @@
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine": "^1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"node-sass": "^4.7.2",
"protractor": "~5.2.0",
......@@ -82,7 +82,7 @@
"ts-node": "~3.3.0",
"tslint": "~5.8.0",
"typescript": "2.4.2",
"uglify-js": "^3.1.10"
"uglify-js": "^3.2.1"
},
"keywords": [
"arsnova",
......
......@@ -29,10 +29,12 @@ export class QuestionTextService {
if (this._inputCache[value]) {
return new Promise((resolve => resolve(this._inputCache[value])));
}
const matchForDollar = value.match(/( ?\${1,2}.*\$)/g);
const matchForDollar = value.match(/(\${1,2}.*\$)/g);
const matchForBlock = value.match(/(\\(.)*\\.*)/g);
let result = value;
let mathjaxValues = [];
if (matchForDollar) {
mathjaxValues = mathjaxValues.concat(matchForDollar);
}
......@@ -43,17 +45,23 @@ export class QuestionTextService {
return new Promise((resolve) => {
if (mathjaxValues.length) {
this.parseMathjax(mathjaxValues).then((mathjaxRendered) => {
result = parseGithubFlavoredMarkdown(result);
mathjaxValues.forEach((mathjaxValue: string, index: number) => {
result = result.replace(mathjaxValue, mathjaxRendered[index].svg);
});
result = parseGithubFlavoredMarkdown(result);
this._inputCache[value] = result;
resolve(result);
});
} else {
result = parseGithubFlavoredMarkdown(result);
this._inputCache[value] = result;
resolve(result);
}
});
}
......
......@@ -12,6 +12,7 @@ export function parseGithubFlavoredMarkdown(value: string): string {
sanitize: false,
smartLists: false,
smartypants: false,
mathDelimiters: [['$', '$'], ['\\(', '\\)'], ['\\[', '\\]'], ['$$', '$$'], 'beginend'],
highlight: function (code) {
return highlight.highlightAuto(code).value;
}
......
......@@ -35,6 +35,7 @@ p {
margin: 0;
img {
max-width: 100%;
max-height: 50vh;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment