mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-07 20:28:38 +00:00
Fix anchor.toMarkup (#1246)
* Fix anchor.toMarkup * Add space between `a`(tag name) and `href`(attribute name) * Remove `this.href` appended to `markup` in the template literal * Add regression test on #1245
This commit is contained in:
@@ -290,7 +290,7 @@ class anchor implements HtmlDomInterface {
|
|||||||
let markup = "<a";
|
let markup = "<a";
|
||||||
|
|
||||||
// Add the href
|
// Add the href
|
||||||
markup += `href="${markup += utils.escape(this.href)}"`;
|
markup += ` href="${utils.escape(this.href)}"`;
|
||||||
// Add the class
|
// Add the class
|
||||||
if (this.classes.length) {
|
if (this.classes.length) {
|
||||||
markup += ` class="${utils.escape(createClass(this.classes))}"`;
|
markup += ` class="${utils.escape(createClass(this.classes))}"`;
|
||||||
|
@@ -2591,6 +2591,11 @@ describe("An href command", function() {
|
|||||||
const ae = getParsed(`\\href{${input}}{\\alpha}`)[0];
|
const ae = getParsed(`\\href{${input}}{\\alpha}`)[0];
|
||||||
expect(ae.value.href).toBe(url);
|
expect(ae.value.href).toBe(url);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should be marked up correctly", function() {
|
||||||
|
const markup = katex.renderToString("\\href{http://example.com/}{example here}");
|
||||||
|
expect(markup).toContain("<a href=\"http://example.com/\">");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("A parser that does not throw on unsupported commands", function() {
|
describe("A parser that does not throw on unsupported commands", function() {
|
||||||
|
Reference in New Issue
Block a user