---
title: 'New features in v1'
date: '2021-06-29'
tags: ['next-js', 'tailwind', 'guide']
draft: false
summary: 'An overview of the new features released in v1 - code block copy, multiple authors, frontmatter layout and more'
layout: PostSimple
---
## Overview
A post on the new features introduced in v1.0. New features:
- [Theme colors](#theme-colors)
- [Xdm MDX compiler](#xdm-mdx-compiler)
- [Layouts](#layouts)
- [Multiple authors](#multiple-authors)
- [Copy button for code blocks](#copy-button-for-code-blocks)
- [Line highlighting and line numbers](#line-highlighting-and-line-numbers)
## Theme colors
You can easily modify the theme color by changing the primary attribute in the tailwind config file:
```js:tailwind.config.js
theme: {
colors: {
primary: colors.teal,
gray: colors.trueGray,
...
}
...
}
```
The primary color attribute should be assigned an object with keys from 50, 100, 200 ... 900 and the corresponding color code values.
Tailwind includes great default color palettes that can be used for theming your own website. Check out [customizing colors documentation page](https://tailwindcss.com/docs/customizing-colors) for the full range of options.
Migrating from v1? You can revert to the previous theme by setting `primary` to `colors.sky` (Tailwind 2.2.2 and above, otherwise `colors.lightBlue`) and changing gray to `colors.coolGray`.
## Xdm MDX compiler
We switch the MDX bundler from [next-mdx-remote](https://github.com/hashicorp/next-mdx-remote) to [mdx-bundler](https://github.com/kentcdodds/mdx-bundler).
This uses [xdm](https://github.com/wooorm/xdm) under the hood uses the latest micromark 3 and remark, rehype libraries.
**Warning:** If you were using custom remark or rehype libraries, please upgrade to micromark 3 compatible ones. If you are upgrading, please delete `node_modules` and `package-lock.json` to avoid having past dependencies related issues.
[xdm](https://github.com/wooorm/xdm) contains multiple improvements over [@mdx-js/mdx](https://github.com/mdx-js/mdx), the compiler used internally by next-mdx-remote, but there might be some breaking behaviour changes.
Please check your markdown output to verify.
Some new possibilities include loading components directly in the mdx file using the import syntax and including js code which could be compiled at the build step.
## Layouts
You can map mdx blog content to layout components by configuring the frontmatter field. For example, this post is written with the new `PostSimple` layout!
### Adding new templates
layout templates are stored in the `./layouts` folder. You can add add your React components that you want to map to markdown content in this folder.
The component file name must match that specified in the markdown frontmatter `layout` field.
The only required field is `children` which contains the rendered MDX content, though you would probably want to pass in the frontMatter contents and render it in the template.
You can configure the template to take in other fields - see `PostLayout` component for an example.
Here's an example layout which you can further customise:
```js
export default function ExampleLayout({ frontMatter, children }) {
const { date, title } = frontMatter
return (
{title}
` blocks. ## Line highlighting and line numbers Line highlighting and line numbers is now supported out of the box thanks to the new [rehype-prism-plus plugin](https://github.com/timlrx/rehype-prism-plus) The following javascript code block: ```` ```js {1, 3-4} showLineNumbers var num1, num2, sum num1 = prompt('Enter first number') num2 = prompt('Enter second number') sum = parseInt(num1) + parseInt(num2) // "+" means "add" alert('Sum = ' + sum) // "+" means combine into a string ``` ```` will appear as: ```js {1,3-4} showLineNumbers var num1, num2, sum num1 = prompt('Enter first number') num2 = prompt('Enter second number') sum = parseInt(num1) + parseInt(num2) // "+" means "add" alert('Sum = ' + sum) // "+" means combine into a string ``` To modify the styles, change the following class selectors in the `tailwind.css` file: ```css .code-line { @apply pl-4 -mx-4 border-l-4 border-gray-800; } .highlight-line { @apply -mx-4 bg-gray-700 bg-opacity-50 border-l-4 border-primary-500; } .line-number::before { @apply pr-4 -ml-2 text-gray-400; content: attr(line); } ```