Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion docs/userGuide/syntax/icons.mbdf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Please use the new :prefix-name: syntax instead.
1. Construct the MarkBind name for the selected icon by adding the _type prefix_.
Note: Font Awesome has three different styles for their icons, each with their own type prefix. Here is an example from each type:
* _Solid_ (prefix: `fas-`) e.g., :fas-file-code: (actual name `file-code`, MarkBind name `fas-file-code`)
* _Regular_ (prefix: `far-`) e.g., :fas-file-code: (actual name `file-code`, MarkBind name `far-file-code`)
* _Regular_ (prefix: `far-`) e.g., :far-file-code: (actual name `file-code`, MarkBind name `far-file-code`)
* _Brands_ (prefix: `fab-`): e.g., :fab-github-alt: (actual name `github-alt`, MarkBind name `fab-github-alt`)

1. Insert MarkBind name for the icon enclosed within colons to get the icon in your page.<br>
Expand Down
24 changes: 1 addition & 23 deletions src/Site.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ const ABOUT_MARKDOWN_FILE = 'about.md';
const BUILT_IN_PLUGIN_FOLDER_NAME = 'plugins';
const BUILT_IN_DEFAULT_PLUGIN_FOLDER_NAME = 'plugins/default';
const FAVICON_DEFAULT_PATH = 'favicon.ico';
const FONT_AWESOME_PATH = 'asset/font-awesome.csv';
const FOOTER_PATH = '_markbind/footers/footer.md';
const HEADER_PATH = '_markbind/headers/header.md';
const GLYPHICONS_PATH = 'asset/glyphicons.csv';
const HEAD_FOLDER_PATH = '_markbind/head';
const INDEX_MARKDOWN_FILE = 'index.md';
const MARKBIND_PLUGIN_PREFIX = 'markbind-plugin-';
Expand Down Expand Up @@ -220,25 +218,6 @@ function rejectHandler(reject, error, removeFolders) {
});
}

function getIconsMap() {
const fontAwesomePath = path.join(__dirname, FONT_AWESOME_PATH);
const glyphiconsPath = path.join(__dirname, GLYPHICONS_PATH);
const fontAwesomeClasses = fs.readFileSync(fontAwesomePath, 'utf8').trimRight().split(/\r?\n/);
const glyphiconsClasses = fs.readFileSync(glyphiconsPath, 'utf8').trimRight().split(/\r?\n/);
const iconsMap = {};
fontAwesomeClasses.forEach((fontAwesomeClass) => {
const name = fontAwesomeClass.replace(' fa', '').replace(/-/g, '_');
const html = `<span class='${fontAwesomeClass}'></span>`;
iconsMap[name] = html;
});
glyphiconsClasses.forEach((glyphiconClass) => {
const name = glyphiconClass.replace(/-/g, '_');
const html = `<span class='glyphicon ${glyphiconClass}' aria-hidden='true'></span>`;
iconsMap[name] = html;
});
return iconsMap;
}

function setExtension(filename, ext) {
return path.join(
path.dirname(filename),
Expand Down Expand Up @@ -665,12 +644,11 @@ Site.prototype.collectUserDefinedVariablesMap = function () {
// The key is the base directory of the site/subsites,
// while the value is a mapping of user defined variables
this.userDefinedVariablesMap = {};
const iconsMap = getIconsMap();
const markbindVariable = { MarkBind: MARKBIND_LINK_HTML };

this.baseUrlMap.forEach((base) => {
const userDefinedVariables = {};
Object.assign(userDefinedVariables, iconsMap, markbindVariable);
Object.assign(userDefinedVariables, markbindVariable);

let content;
try {
Expand Down
Loading