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

Add the ability to define a default language #206

Merged
merged 2 commits into from
Nov 1, 2017
Merged

Conversation

vjeux
Copy link
Contributor

@vjeux vjeux commented Nov 1, 2017

I don't want to have to add the language i'm working on to every single block nor do I want to rely on a default heuristic to find the language.

This adds the ability to write

highlight: { defaultLang: 'xxxx' }

in siteConfig.js to force the language when not specified.

I tested it without a a highlight block, without a defaultLang attribute and with one and with a wrong one. All of them work as expected.

I don't want to have to add the language i'm working on to every single block nor do I want to rely on a default heuristic to find the language.

This adds the ability to write

```
highlight: { defaultLang: 'xxxx' }
```

in `siteConfig.js` to force the language when not specified.

I tested it without a a highlight block, without a defaultLang attribute and with one and with a wrong one. All of them work as expected.
@vjeux vjeux requested a review from hramos November 1, 2017 17:23
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Nov 1, 2017
Copy link
Contributor

@JoelMarcey JoelMarcey left a comment

Choose a reason for hiding this comment

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

Cool. Thanks.

I can update https://docusaurus.io/docs/en/site-config.html to reference this new config option.

@@ -42,30 +42,32 @@ class Remarkable extends React.Component {

renderMarkdown(source) {
if (!this.md) {
// Allow client sites to register their own plugins
const siteConfig = require(CWD + "/siteConfig.js");
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason not to put this up top with the other requires?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason I put it there in the first place was so that if we reset the require, it's going to get a fresh version. But looks like we're not doing it yet, so right now it wouldn't make a difference: #205 (comment)

@@ -42,30 +42,32 @@ class Remarkable extends React.Component {

renderMarkdown(source) {
if (!this.md) {
// Allow client sites to register their own plugins
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment may not make as much sense in this scope.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, I'll move it back

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

Successfully merging this pull request may close these issues.

3 participants