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
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"get-object-path": "azer/get-object-path#74eb42de0cfd02c14ffdd18552f295aba723d394",
"hadron-action": "^0.0.4",
"hadron-auto-update-manager": "^0.0.12",
"hadron-compile-cache": "^0.2.0",
"hadron-compile-cache": "^0.3.0",
"hadron-component-registry": "^0.4.0",
"hadron-document": "^0.14.0",
"hadron-ipc": "^0.0.7",
Expand All @@ -119,7 +119,6 @@
"local-links": "^1.4.0",
"lodash": "^3.10.1",
"marked": "^0.3.5",
"marky-mark": "^1.2.1",
"moment": "^2.10.6",
"mongodb-collection-model": "^0.2.3",
"mongodb-connection-model": "^4.3.0",
Expand Down Expand Up @@ -152,7 +151,7 @@
"devDependencies": {
"eslint-config-mongodb-js": "^1.0.6",
"eslint-plugin-react": "^4.1.0",
"hadron-build": "^0.6.3",
"hadron-build": "^0.6.5",
"hadron-test-utils": "^0.0.8",
"xvfb-maybe": "^0.1.3"
},
Expand Down
25 changes: 8 additions & 17 deletions src/help/help-entry-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ var selectableMixin = require('../app/models/selectable-collection-mixin');
var filterableMixin = require('ampersand-collection-filterable');
var withSync = require('../app/models/with-sync');
var debug = require('debug')('mongodb-compass:help:help-entry-collection');
var mm = require('marky-mark');
var path = require('path');
var _ = require('lodash');
var highlight = require('highlight.js');
var fs = require('fs');

var HelpEntryCollection = Collection.extend(
selectableMixin, lodashMixin, filterableMixin, {
Expand All @@ -29,25 +28,17 @@ var HelpEntryCollection = Collection.extend(
}

var dir = path.join(__dirname, 'entries');
debug('parsing entries with marky-mark from `%s`', dir);

// add syntax highlighting options, pass through to `marked` module
var parserOptions = {
marked: {
highlight: function(code) {
var result = highlight.highlightAuto(code).value;
return result;
}
}
};

mm.parseDirectory(dir, parserOptions, function(err, entries) {
fs.readdir(dir, function(err, files) {
if (err) {
debug('error parsing entries', err);
debug('error reading entries', err);
done(err);
return;
}
debug('successfully parsed!', entries);

var entries = _.map(files, function(file) {
return require(path.join(dir, file));
});

// in production don't return the dev-only entries
if (process.env.NODE_ENV === 'production') {
entries = _.filter(entries, function(entry) {
Expand Down
4 changes: 1 addition & 3 deletions src/help/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ var HelpPage = View.extend({
if (!entry) {
debug('Unknown help entry', entryId);
this.viewSwitcher.clear();
app.statusbar.showMessage({
message: 'Help entry not found.'
});
app.statusbar.showMessage('Help entry not found.');
return;
}

Expand Down