简体   繁体   English

如何调整渲染 markdown 的默认字体大小

[英]How to adjust default font size of rendered markdown

I have a textarea which initially captures text with SimpleMDE (markdown) and is stored in mysql.我有一个文本区域,它最初使用 SimpleMDE(降价)捕获文本并存储在 mysql 中。 On retrieval I use 'Marked' markdown renderer to display contents in a div, like this...在检索时,我使用 'Marked' markdown 渲染器在 div 中显示内容,如下所示...

<div id="content" style="position:relative; width:auto; margin-left:10px; font-size:medium;"></div>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script>document.getElementById('content').innerHTML = marked(`<?php echo nl2br($dispdesc); ?>`);</script>

I expected the font size (medium) defined in the div to be the default for all the text when diplayed, but it seems to only apply to lines of text which are bulleted and lines that follow that.我希望 div 中定义的字体大小(中等)在显示时是所有文本的默认值,但它似乎只适用于带有项目符号的文本行和后面的行。 The lines before the first bulleted line (or all lines if there are no bullets) appear in a much smaller text.第一个项目符号行之前的行(如果没有项目符号,则为所有行)以小得多的文本显示。 Any ideas why this might be?任何想法为什么会这样?

Here is some HTML output...这是一些 HTML output ...

<div id="content" style="position:relative; width:auto; margin-left:10px; font-size:medium;"></div>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script>document.getElementById('content').innerHTML = marked(`aaaaaaaaaa<br />
bbbbbbbbbbbbb<br />
bbbbb<br />
* cccccccccccccccccccc<br />
* ddddddddddddddddd<br />
eeeeeeeeeeeeeeeeee<br />
ffffffffffff<br />
`);</script>

Thanks to those who helped.感谢那些帮助过的人。 I didn't work out what the problem was, but I am now testing a different strategy so have by-passed the problem.我没有弄清楚问题是什么,但我现在正在测试一种不同的策略,所以绕过了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM