| | |
| | | |
| | | // 添加自定义样式 |
| | | const style = document.createElement('style'); |
| | | // 自定义段落渲染规则 |
| | | md.renderer.rules.paragraph_open = (tokens, idx) => { |
| | | return '<p class="inline-block">'; // 添加 inline-block 类来控制显示 |
| | | }; |
| | | |
| | | // 自定义表格渲染规则 |
| | | md.renderer.rules.table_open = (tokens, idx) => { |
| | | return '<table class="markdown-table">'; |
| | | }; |
| | | |
| | | style.textContent = ` |
| | | .code-markdown-it-block { |
| | | margin: 1em 0; |
| | |
| | | .copy-icon, .check-icon { |
| | | fill: currentColor; |
| | | } |
| | | .markdown-table { |
| | | border-collapse: collapse; |
| | | width: 100%; |
| | | } |
| | | .markdown-table thead { |
| | | background-color: #f2f2f2; |
| | | } |
| | | .markdown-table th, |
| | | .markdown-table td { |
| | | border: 1px solid #ebebeb; |
| | | padding: 8px; |
| | | text-align: center; |
| | | } |
| | | `; |
| | | document.head.appendChild(style); |
| | | export { md }; |