最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

vue.js - How to write a Markdown extension in VuePress - Stack Overflow

programmeradmin3浏览0评论

I want to add an extension to VuePress to be able to make left indents for text.

For this, I created a project pnpm create vuepress-theme-hope my-docs

Added a plugin @vuepress/plugin-register-components": "2.0.0-rc.82

Registered the plugin in the project config.ts

plugins: [
  registerComponentsPlugin({
    componentsDir: path.resolve(__dirname, "./components"),
  }),
],

Created a component: Components\sh.vue

<template>
  <div class="sh-class">
    <slot></slot> <!-- slot outlet -->
  </div>
</template>

<script>
  export default {
    name: 'sh'
  }
</script>

<style scoped>
  .sh-class {
    display: block;
    margin-inline-start: 40px;
  }
</style>

And I use the component in Markdown text. But as a result, the system does not consider the text inside the tag as Markdown. The text inside the tag comes as Plain Text.

<sh>Maring `TObject` Test1</sh>
<br>
Test2
<sh>
An `object` that defines name of components and their corresponding file path.

An object that defines name of components and their corresponding file `path`.
</sh>
<br>

Tell me, is it possible to write a “full-fledged” extension for Markdown format in VuePress?

发布评论

评论列表(0)

  1. 暂无评论