Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

NickColley
Copy link
Contributor

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.

@NickColley
Copy link
Contributor Author

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) || {}
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was accidentally added...

@NickColley
Copy link
Contributor Author

Gonna pause this, write some cards and we can revisit if it makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants