Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/userGuide/siteJsonFile.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Here is a typical `site.json` file:
"baseUrl": "/myproduct",
"faviconPath": "myfavicon.png",
"titlePrefix": "FooBar Dev Docs",
"theme": "bootswatch-cerulean",
"style": {
"bootstrapTheme": "bootswatch-cerulean",
"codeTheme": "light"
},
"pages": [
Expand Down Expand Up @@ -95,18 +95,18 @@ Here is a typical `site.json` file:
**The prefix for all page titles.** The separator <code>-</code> will be inserted by MarkBind.


#### **`theme`**

_(Optional)_ **The theme for the generated site.** Uses the default Bootstrap theme if not specified. See [User Guide: Themes](themes.html) for more details.


#### **`style`**

_(Optional)_ **The styling options to be applied to the site.** This includes:

* **`theme`**
_(Optional)_ **The theme for the generated site.** Uses the default Bootstrap theme if not specified. See [User Guide: Themes](themes.html) for more details.

* **`codeTheme`** [Optional. Default: `"dark"`]<br>
The theme used for fenced code blocks. Accepts either `"light"` or `"dark"`.



#### **`pages`**

**An array of pages to be rendered.**
Expand Down
16 changes: 13 additions & 3 deletions docs/userGuide/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,25 @@

<span class="lead" id="overview">

**MarkBind supports the ability to style your website with a variety of themes.**
**MarkBind supports the ability to style your website with a variety of bootstrap themes.**

</span>

#### Specifying a Theme

You can specify a theme for your site by using the [`theme` property of the `site.json`](siteJsonFile.html#theme). For example, to apply the Cerulean theme, add `"theme": "bootswatch-cerulean"` to your `site.json`.
You can specify a theme for your site by using the [`style.bootstrapTheme` property](siteJsonFile.html#style) of your `site.json` configuration file.

If no `theme` property is specified, your site will be styled with default Bootstrap theme.
For example, to apply the Cerulean theme, add the following configuration:

```json {heading="site.json"}
{
"style": {
"bootstrapTheme": "bootswatch-cerulean"
}
}
```

If no such property is specified, your site will be styled with default Bootstrap theme.

#### Supported Themes

Expand Down
15 changes: 11 additions & 4 deletions packages/core/src/Site/SiteConfig.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const logger = require('../utils/logger');

const {
HEADING_INDEXING_LEVEL_DEFAULT,
} = require('./constants');
Expand Down Expand Up @@ -31,16 +33,21 @@ class SiteConfig {
* @type {number}
*/
this.headingIndexingLevel = siteConfigJson.headingIndexingLevel || HEADING_INDEXING_LEVEL_DEFAULT;
/**
* @type {string}
*/
this.theme = siteConfigJson.theme || false;

/**
* @type {Object<string, any>}
*/
this.style = siteConfigJson.style || {};

/**
* @type {string}
*/
this.theme = this.style.bootstrapTheme || siteConfigJson.theme || false;
if (siteConfigJson.theme) {
logger.warn("The 'theme' site configuration key has been consolidated under the 'style.bootstrapTheme'"
+ ' key.\n The old key will be deprecated in v3.0.');
}

/**
* @type {Array}
*/
Expand Down