Skip to content

Commit

Permalink
feat: now supports math blocks (closes #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Dec 9, 2021
1 parent bfe8344 commit 96c1935
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class MarkdownAttributes extends Plugin {

/** Get the source for this element. Only look at the top line for code blocks. */
let source = text.split("\n").slice(lineStart, lineStart + 1);
let str = source.join("\n");
str = source.join("\n");
/** Test if the element contains attributes. */
if (!Processor.BASE_RE.test(str)) return;

Expand All @@ -47,10 +47,13 @@ export default class MarkdownAttributes extends Plugin {
}

/**
* Table elements should check the next line in the source to see if it is a single block attribute,
* Table elements and Mathjax elements should check the next line in the source to see if it is a single block attribute,
* because those block attributes are not applied to the table.
*/
if (child instanceof HTMLTableElement) {
if (
child instanceof HTMLTableElement ||
(child.hasClass("math") && child.hasClass("math-block"))
) {
if (!ctx.getSectionInfo(topElement)) return;

/** Pull the Section data. */
Expand Down

0 comments on commit 96c1935

Please sign in to comment.