Skip to content

Commit f2f1d20

Browse files
durranimlucas
authored andcommitted
INT-1616: Add markdown (help sections) to compile cache. (#435)
* INT-1616: Use compile cache with markdown * INT-1616: Update to latest compile cache * Remove the .nvmrc * INT-1616: Bump hadron-build
1 parent 2c3ce9f commit f2f1d20

File tree

3 files changed

+11
-23
lines changed

3 files changed

+11
-23
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"get-object-path": "azer/get-object-path#74eb42de0cfd02c14ffdd18552f295aba723d394",
103103
"hadron-action": "^0.0.4",
104104
"hadron-auto-update-manager": "^0.0.12",
105-
"hadron-compile-cache": "^0.2.0",
105+
"hadron-compile-cache": "^0.3.0",
106106
"hadron-component-registry": "^0.4.0",
107107
"hadron-document": "^0.14.0",
108108
"hadron-ipc": "^0.0.7",
@@ -119,7 +119,6 @@
119119
"local-links": "^1.4.0",
120120
"lodash": "^3.10.1",
121121
"marked": "^0.3.5",
122-
"marky-mark": "^1.2.1",
123122
"moment": "^2.10.6",
124123
"mongodb-collection-model": "^0.2.3",
125124
"mongodb-connection-model": "^4.3.0",
@@ -152,7 +151,7 @@
152151
"devDependencies": {
153152
"eslint-config-mongodb-js": "^1.0.6",
154153
"eslint-plugin-react": "^4.1.0",
155-
"hadron-build": "^0.6.3",
154+
"hadron-build": "^0.6.5",
156155
"hadron-test-utils": "^0.0.8",
157156
"xvfb-maybe": "^0.1.3"
158157
},

src/help/help-entry-collection.js

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ var selectableMixin = require('../app/models/selectable-collection-mixin');
55
var filterableMixin = require('ampersand-collection-filterable');
66
var withSync = require('../app/models/with-sync');
77
var debug = require('debug')('mongodb-compass:help:help-entry-collection');
8-
var mm = require('marky-mark');
98
var path = require('path');
109
var _ = require('lodash');
11-
var highlight = require('highlight.js');
10+
var fs = require('fs');
1211

1312
var HelpEntryCollection = Collection.extend(
1413
selectableMixin, lodashMixin, filterableMixin, {
@@ -29,25 +28,17 @@ var HelpEntryCollection = Collection.extend(
2928
}
3029

3130
var dir = path.join(__dirname, 'entries');
32-
debug('parsing entries with marky-mark from `%s`', dir);
33-
34-
// add syntax highlighting options, pass through to `marked` module
35-
var parserOptions = {
36-
marked: {
37-
highlight: function(code) {
38-
var result = highlight.highlightAuto(code).value;
39-
return result;
40-
}
41-
}
42-
};
43-
44-
mm.parseDirectory(dir, parserOptions, function(err, entries) {
31+
fs.readdir(dir, function(err, files) {
4532
if (err) {
46-
debug('error parsing entries', err);
33+
debug('error reading entries', err);
4734
done(err);
4835
return;
4936
}
50-
debug('successfully parsed!', entries);
37+
38+
var entries = _.map(files, function(file) {
39+
return require(path.join(dir, file));
40+
});
41+
5142
// in production don't return the dev-only entries
5243
if (process.env.NODE_ENV === 'production') {
5344
entries = _.filter(entries, function(entry) {

src/help/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,7 @@ var HelpPage = View.extend({
128128
if (!entry) {
129129
debug('Unknown help entry', entryId);
130130
this.viewSwitcher.clear();
131-
app.statusbar.showMessage({
132-
message: 'Help entry not found.'
133-
});
131+
app.statusbar.showMessage('Help entry not found.');
134132
return;
135133
}
136134

0 commit comments

Comments
 (0)