Open Dhaulagiri opened 1 year ago
Thanks! I did this technique, too, and used my own show controller.
Here is my version though, because extend is from the dark ages 😅
import showdown from 'showdown';
import footnotes from 'showdown-ghost-footnotes';
import Controller from '@ember/controller';
import { cached } from '@glimmer/tracking';
import config from 'my-app/config/environment';
// Overrides: https://github.com/empress/field-guide/blob/master/addon/controllers/show.js
// see: https://github.com/empress/field-guide/issues/73
export default class Show extends Controller {
fieldGuideConfig = config['field-guide'];
@cached
get renderedContent() {
const converter = new showdown.Converter({ extensions: [footnotes] });
return converter.makeHtml(this.model.content);
}
}
Per the docs for ember-cli-showdown it should be possible to set global showdown config via an app's
environment.js
. However, these options don't appear to be passed along to showdown as part of the way showdown is invoked in field-guide.I was able to make this work by doing something like this, but it's unclear if this is the best solution of if there is something else I'm missing here.