德罗宾斯的大规模杀伤性武器有几个问题
我对 Derobin 的 WMD 编辑器实现有一个小问题。
它似乎没有正确格式化,我也不完全确定为什么。虽然我不确定我是否应该在 Doctype 上问这个问题。
我使用的是 SO 参考中的 Markdown 文本示例,它当然应该如下所示:
- 列表项中的列表:
- 缩进四个空格。
- 缩进八个空格。
- 又是四个空格。
- 缩进四个空格。
列表项中的多个段落: 段落最好缩进四个空格 你可以逃脱三个,但它可以得到 当你嵌套其他东西时会令人困惑。 坚持四个。
我们在第一行缩进了一个额外的空格来对齐 它与这些段落。在实际使用中,我们可能会这样做 到整个列表,以便所有项目对齐。
该段落仍然是列表项的一部分,但对人类来说看起来很混乱。因此,像我们对前两个段落所做的那样,手动包装嵌套段落是个好主意。
列表项中的块引用:
跳过一行并 缩进 > 的四个空格。
列表项中的预格式化文本:
跳过一行并缩进八个空格。 列表中有四个空格 四个触发代码块。
但是,我得到的内容如下所示:
我认为这与 CSS 相关,但我看不出是什么原因造成的。如果需要,我可以发布 CSS,但我可能会发布所有 CSS,因为我不确定是什么原因造成的。但是,我不确定它是否可能是实际的脚本本身(我觉得这很可疑,因为示例有效并且我只是复制了相同的代码)。
我还应该指出,下载 WMD 附带的示例本身可以正常工作,但是一旦我将其添加到我的应用程序中,就会发生上述情况。
我还应该补充一点,这个问题在 IE7/8 和 Firefox 3.5 中仍然存在。
非常感谢任何帮助。
编辑:通过为 list-style-position: inside 的 ol 和 ul 添加 CSS 样式,解决了出现在框外的项目符号/数字;但其余部分仍然保持不变。
编辑:根据用户评论进行编辑。输出的 HTML 是:
<ol>
<li>Lists in a list item:
<ul><li>Indented four spaces.
<ul><li>indented eight spaces.</li></ul></li>
<li>Four spaces again.</li></ul></li>
<li><p>Multiple paragraphs in a list items:
It's best to indent the paragraphs four spaces
You can get away with three, but it can get
confusing when you nest other things.
Stick to four.</p>
<p>We indented the first line an extra space to align
it with these paragraphs. In real use, we might do
that to the entire list so that all items line up.</p>
<p>This paragraph is still part of the list item, but it looks messy to humans. So it's a good idea to wrap your nested paragraphs manually, as we did with the first two.</p></li>
<li><p>Blockquotes in a list item:</p></li>
</ol>
<blockquote>
<p>Skip a line and
indent the >'s four spaces.</p>
</blockquote>
<ol>
<li><p>Preformatted text in a list item:</p>
<pre><code>Skip a line and indent eight spaces.
That's four spaces for the list
and four to trigger the code block.
</code></pre></li>
</ol>
I've got a small issue with Derobin's implementation of WMD editor.
It doesn't seem to be formatting properly and I'm not entirely sure why. Though I'm not sure if I should be asking this on Doctype or not either.
I was using the markdown text examples from the SO reference, which of course should look like the below:
- Lists in a list item:
- Indented four spaces.
- indented eight spaces.
- Four spaces again.
- Indented four spaces.
Multiple paragraphs in a list items:
It's best to indent the paragraphs four spaces
You can get away with three, but it can get
confusing when you nest other things.
Stick to four.We indented the first line an extra space to align
it with these paragraphs. In real use, we might do
that to the entire list so that all items line up.This paragraph is still part of the list item, but it looks messy to humans. So it's a good idea to wrap your nested paragraphs manually, as we did with the first two.
Blockquotes in a list item:
Skip a line and
indent the >'s four spaces.
Preformatted text in a list item:
Skip a line and indent eight spaces. That's four spaces for the list and four to trigger the code block.
However, what I get looks like this:
I think this is CSS related, but I can't see what's causing it. I can post the CSS if it's needed but I'd probably post all of it as I'm not sure what's causing it. However, I'm not sure if it could be the actual script itself (which I find doubtful as the examples work and I have merely copied the same exact code).
I should also point out, that the example that comes with the download of WMD works fine on it's own, but once I add it to my application, the above occurs.
I should also add that this problem is persistent in IE7/8 and Firefox 3.5.
Any help is much appreciated.
EDIT: Solved the Bullets/Numbers appearing outside the box with adding CSS style for ol and ul of list-style-position: inside; but the rest still remains the same.
EDIT: Edit based on user comments. The HTML being output is:
<ol>
<li>Lists in a list item:
<ul><li>Indented four spaces.
<ul><li>indented eight spaces.</li></ul></li>
<li>Four spaces again.</li></ul></li>
<li><p>Multiple paragraphs in a list items:
It's best to indent the paragraphs four spaces
You can get away with three, but it can get
confusing when you nest other things.
Stick to four.</p>
<p>We indented the first line an extra space to align
it with these paragraphs. In real use, we might do
that to the entire list so that all items line up.</p>
<p>This paragraph is still part of the list item, but it looks messy to humans. So it's a good idea to wrap your nested paragraphs manually, as we did with the first two.</p></li>
<li><p>Blockquotes in a list item:</p></li>
</ol>
<blockquote>
<p>Skip a line and
indent the >'s four spaces.</p>
</blockquote>
<ol>
<li><p>Preformatted text in a list item:</p>
<pre><code>Skip a line and indent eight spaces.
That's four spaces for the list
and four to trigger the code block.
</code></pre></li>
</ol>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在你的 css 文件中,你有这个:
这是一个通用重置,可以删除所有内容的填充和边距。正如我在 Doctype.com 上所说的。
您需要删除它,并使用更可控的重置,或者为 ul 和 li 设置一些默认的填充和边距。
由于每个浏览器似乎对 ul 有不同的默认值,因此我倾向于忽略它们从我的重置和设置 nav ul 专门。
这是我使用的重置:
它重置了除列表之外的几乎所有内容。
in your css file you have this:
which is a universal reset that removes padding and margin from everything. As I said on Doctype.com.
You will need to remove that, and use a more controllable reset, or set some default padding and margins for ul's and li's in general.
As every browser seems to have different defaults for ul's I tend to omit them from my reset and set nav ul's specifically.
here's the reset I use:
which resets almost everything other than lists.