Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions packages/core/src/lib/markdown-it/markdown-it-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ module.exports = require('markdown-it-regexp')(
if (iconFontType === 'glyphicon') {
return `<span aria-hidden="true" class="glyphicon glyphicon-${iconFontName}"></span>`;
} else if (iconFontType === 'octicon') {
return iconClass ? octicons[iconFontName].toSVG({"class": iconClass})
: octicons[iconFontName].toSVG();
// ensure octicons are valid
if (!octicons.hasOwnProperty(iconFontName)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be above octicons[iconFontName]? 😮

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it shouldn't ... so sorry about that 😓

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected!

return `<span aria-hidden="true"></span>`;
}
return iconClass
? octicons[iconFontName].toSVG({"class": iconClass})
: octicons[iconFontName].toSVG();
} else if (iconFontType === 'octiconlight') {
return iconClass ? octicons[iconFontName].toSVG({"style": "color: #fff;", "class": iconClass})
: octicons[iconFontName].toSVG({"style": "color: #fff;"});
// ensure octicons are valid
if (!octicons.hasOwnProperty(iconFontName)) {
return `<span aria-hidden="true"></span>`;
}
return iconClass
? octicons[iconFontName].toSVG({"style": "color: #fff;", "class": iconClass})
: octicons[iconFontName].toSVG({"style": "color: #fff;"});
} else { // If icon is a Font Awesome icon
return `<span aria-hidden="true" class="${iconFontType} fa-${iconFontName}"></span>`;
}
Expand Down