-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow additional markdown options #170
Conversation
Can we do this via the config.yaml file? |
tables: true, | ||
no_intra_emphasis: true | ||
} | ||
markdown_options = context.config[:tech_docs][:markdown].transform_keys(&:to_sym) || {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if there are no markdown options specified in the config file? Does this need to be guarded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe It'll return falsy and the {} will be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem to like the chaining when I try it:
irb(main):004:0> foo = { :tech_docs => { :something => true }}
=> {:tech_docs=>{:something=>true}}
irb(main):005:0> foo[:tech_docs][:markdown].transform_keys(&:to_sym) || {}
Traceback (most recent call last):
4: from /Users/oliverbyford/.rbenv/versions/2.6.3/bin/irb:23:in `<main>'
3: from /Users/oliverbyford/.rbenv/versions/2.6.3/bin/irb:23:in `load'
2: from /Users/oliverbyford/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
1: from (irb):5
NoMethodError (undefined method `transform_keys' for nil:NilClass)
Looks like it works OK with safe navigation (&.
) though:
irb(main):004:0> foo = { :tech_docs => { :something => true }}
=> {:tech_docs=>{:something=>true}}
irb(main):006:0> foo[:tech_docs][:markdown]&.transform_keys(&:to_sym) || {}
=> {}
irb(main):007:0> foo = { :tech_docs => { :something => true, :markdown => { :be_awesome => true }}}
=> {:tech_docs=>{:something=>true, :markdown=>{:be_awesome=>true}}}
irb(main):008:0> foo[:tech_docs][:markdown]&.transform_keys(&:to_sym) || {}
=> {:be_awesome=>true}
@@ -2,6 +2,11 @@ | |||
|
|||
## Unreleased | |||
|
|||
### Fixes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was accidentally added...
Gonna pause this, write some cards and we can revisit if it makes sense. |
I think turning on new features may be too controversial so I'm adding functionality so the user can set their own preferences.
See #169 for why I want to do this.