Skip to content

allow markdown.config in config.yml fix #326 #579

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

Closed
wants to merge 1 commit into from
Closed

allow markdown.config in config.yml fix #326 #579

wants to merge 1 commit into from

Conversation

neumayr
Copy link

@neumayr neumayr commented Jun 13, 2018

  • allow setup of markdown.config in config.yml

markdown.config is a String and not evaluated as a function if you use config.yml

# .vuepress/config.yml
title: Awesome docs
description: Vuepress rocks
markdown:
  lineNumbers: true
  config: |
    md => {
      md.use(require('markdown-it-checkbox'))
      md.use(require('markdown-it-ins'))
      md.use(require('markdown-it-mark'))
    }

🔗 #326

/cc @luminarious


Summary

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

If changing the UI of default theme, please provide the before/after screenshot:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)

You have tested in the following browsers: (Providing a detailed version will be better.)

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature
  • Related documents have been updated
  • Related tests have been updated

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

We aren't ecmascript pros. And we know eval is evil in some context. But we had no better idea…

* allow setup of `markdown.config` in `config.yml``markdown.config` is a
`String` and not evaluated as a function if you use `config.yml

````yaml
title: Awesome docs
description: Vuepress rocks
markdown:
  lineNumbers: true
    config: |
      md => {
       md.use(require('markdown-it-checkbox'))
       md.use(require('markdown-it-ins'))
       md.use(require('markdown-it-mark'))
      }
```

:link: #326 @luminarious

Co-Authored-By: Michi0301 <[email protected]>
@ulivz
Copy link
Member

ulivz commented Jun 13, 2018

Thanks for your work. but we don't think we should support for that.

As you can imagine, when the user does not give config a valid JavaScript string, this will give an error.

So if you need anything JavaScript, please use JS. thanks.

@ulivz ulivz closed this Jun 13, 2018
@neumayr
Copy link
Author

neumayr commented Jun 13, 2018

@ulivz Is there a way to do further checks about this. For example, if the config format is .yml.
Imho, reporting an error is 10x better than not supporting this feature for a supported config format.

Another idea is to allow a config.js and config.yml get merged. So doing the required markdown.config in the JS file.
Or adding a markdown.plugins outlet for specifying plugins as an array.

@neumayr neumayr deleted the allow-yaml-markdown-config branch March 13, 2019 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants