A remark plugin for formatting code blocks using Prettier
npm install remark-code-formatA remark plugin for formatting code blocks using Prettier.
You can install remark-code-format using npm or yarn:
``bash`
npm install remark-code-format --save-devor
yarn add remark-code-format --dev
Note: Be sure to install the prettier package as well.
Once you've installed the plugin, you can use it in your remark configuration. Here's an example of how to configure it:
`js
import { remark } from 'remark'
import remarkCodeFormat from 'remark-code-format'
const markdown = Greetings, traveler! Sign up today!
\\\html prettier\
\\
const file = await remark()
.use(remarkCodeFormat, {
/ Prettier options /
})
.process(markdown)
console.log(String(file))
`
🚨 Important: The prettier attribute must be specified in code fence blocks for formatting the code.
Yields:
`` Greetings, traveler! Sign up today!md`html`
``
Prettier configuration can be specified in code fence blocks using the prettier attribute, it has a higher priority than plugin Options. For example:
``md`ts prettier="{ parser: 'typescript' }"`
// your code here``
- remark-code-jsx-renderer
- remark-code-preview
We 💛 issues.
When committing, please conform to the semantic-release commit standards. Please install commitizen and the adapter globally, if you have not already.
`bash`
npm i -g commitizen cz-conventional-changelog
Now you can use git cz or just cz instead of git commit when committing. You can also use git-cz, which is an alias for cz.
`bash``
git add . && git cz
A project by Stilearning © 2023.