Skip to content

Commit

Permalink
fix: empty class
Browse files Browse the repository at this point in the history
  • Loading branch information
true_mogician committed Aug 18, 2021
1 parent 7d4162f commit 640c182
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/mdast-util-details/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ export const fromMarkdownDetails: Extension = {
detailsContainerSummary: function (token) {
// pushin all the attributes for <details> tag before entering <summary> tag
const attributes = getDetailsAttributes(this);
const cleaned = {
const cleaned: {
open: boolean,
class?: string
} = {
open: false,
class: ""
}
const classes: string[] = [];
for (const attribute of attributes) {
Expand All @@ -36,7 +38,8 @@ export const fromMarkdownDetails: Extension = {
else
cleaned.open = attribute[1];
}
cleaned.class = classes.join(' ');
if (classes.length > 0)
cleaned.class = classes.join(' ');
this.setData('detailsAttributes');
(this.stack[this.stack.length - 1] as any).attributes = cleaned;
enter.call(this, 'detailsContainerSummary', token, 'summary');
Expand Down

0 comments on commit 640c182

Please sign in to comment.