docusaurus/website/docs/theme-classic.md
Alexey Pyltsyn c507028cb0
feat(v2): add ability default lang for code blocks (#1910)
* feat(v2): add ability default lang for code blocks

* Add support for CodeBlock

* changelog

* more changelog

* Add checks

* docs

* docs

* Fix changelog

* revert config

* Update theme-classic.md

* Update packages/docusaurus-theme-classic/src/theme/CodeBlock/index.js

Co-Authored-By: Endi <endiliey@gmail.com>
2019-11-05 10:36:22 +03:00

85 lines
1.8 KiB
Markdown

---
id: theme-classic
title: Classic Theme Configuration
---
_This section is a work in progress._
## Navbar
### Navbar Title & Logo
You can add a logo and title to the navbar via `themeConfig.navbar`. Logo can be placed in [static folder](static-assets.md).
```js
// docusaurus.config.js
module.exports = {
themeConfig: {
navbar: {
title: 'Site Title',
logo: {
alt: 'Site Logo',
src: 'img/logo.svg',
},
}
}
```
### Navbar Links
You can add links to the navbar via `themeConfig.navbar.links`:
```js
// docusaurus/config.js
module.exports = {
themeConfig: {
navbar: {
links: [
{
to: 'docs/docusaurus.config.js',
label: 'docusaurus.config.js',
position: 'left',
},
// ... other links
],
}
}
```
Outbound links automatically get `target="_blank" rel="noopener noreferrer"`.
## Footer
## `CodeBlock`
Docusaurus uses [Prism React Renderer](https://github.com/FormidableLabs/prism-react-renderer) to highlight code blocks.
### Theme
By default, we use [Palenight](https://github.com/FormidableLabs/prism-react-renderer/blob/master/src/themes/palenight.js) as syntax highlighting theme. You can specify a custom theme from the [list of available themes](https://github.com/FormidableLabs/prism-react-renderer#theming), e.g.:
```js
// docusaurus/config.js
module.exports = {
themeConfig: {
prism: {
theme: require('prism-react-renderer/themes/dracula'),
},
}
}
```
### Default language
You can set a default language for code blocks if no language is added after the opening triple backticks (i.e. ```). Note that a valid [language name](https://prismjs.com/#supported-languages) must be passed, e.g.:
```js
// docusaurus/config.js
module.exports = {
themeConfig: {
prism: {
defaultLanguage: 'javascript',
},
}
}
```