当前位置: 首页 > 工具软件 > Markdown.css > 使用案例 >

文章正文使用makdown的样式神器 github-markdown-css ,使用超简单,

甘学潞
2023-12-01

关于文章正文的样式

文章正文包括各种数据:段落、标题、列表、链接、图片、视频等资源。

  • github-markdown-css 样式文件下载到项目中

    yarn add  github-markdown-css
    
  • 导入

    import './github-markdown.css'
    
  • 在对应的文章标签添加类名

    <div class="article-content markdown-body" v-html="article.content"></div>
    
  • 配置postcss包不要自动转换github-markdown-css样式文件中的字号,不然会影响不同客户端之间的体验

    'postcss-pxtorem': {
          rootValue ({ file }) {
            return file.indexOf('vant') !== -1 ? 37.5 : 75
          },
          propList: ['*'],
          exclude: 'github-markdown'
        }
    
 类似资料: