johno / ember-remarkable

Ember addon for Remarkable markdown parsing helpers and components.
MIT License
26 stars 20 forks source link

Tolerate absence of remarkable config #34

Closed chrislopresto closed 7 years ago

chrislopresto commented 7 years ago

In the process of upgrading ember-freestyle to the latest ember-remarkable, I noticed the following error if the remarkable config was absent:

ember.debug.js:19829 TypeError: Cannot read property 'excludeHighlightJs' of undefined
    at Class.<anonymous> (md-text.js:24)
    at ComputedPropertyPrototype.get (ember.debug.js:19337)
    at Object.get (ember.debug.js:24154)
    at Class.get (ember.debug.js:37057)
    at Class.<anonymous> (md-text.js:27)
    at ComputedPropertyPrototype.get (ember.debug.js:19337)
    at Object.get (ember.debug.js:24154)
    at Class.get (ember.debug.js:37057)
    at Class._super (md-text.js:55)
    at Class.<anonymous> (freestyle-md-text.js:10)

I figure it's desirable to tolerate the absence of the config object, hence this PR. It seems like the existing coverage is adequate, but let me know if you want any different tests, clarification, etc.

Cheers!

App using an addon using an addon... This problem was present in a test app I have set up that consumes ember-freestyle. I don't want to make ember-freestyle users include a `remarkable: {}` config object in their environment.js. Also, as far as I can tell, it's not possible for them to exclude highlight.js in this addon within an addon scenario. So I don't want folks to get their hopes up just yet. I'm working on a separate solution to make highlight.js optional in ember-freestyle, so things should work out one way or another.
johno commented 7 years ago

Thanks!

johno commented 7 years ago

Published to npm as ember-remarkable@3.6.1. Let me know if you encounter any other issues 🍻