我可以停止CodeProject上的块以使其左对齐吗? [英] Can I stop blocks on CodeProject from rendering left-justified?

查看:91
本文介绍了我可以停止CodeProject上的块以使其左对齐吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我查看有关CodeProject(在IE9中)的文章时,< pre>块渲染,每行左对齐.如果我复制并粘贴代码,则似乎有空格.

如果您将这些片段记为"Pretty",则该问题没有任何意义.更改格式前,请*阅读*.谢谢!

例如(并且不使用任何代码块标签,以免通过调用错误隐藏有关错误的问题!),此html:
-------------------------------------------------- ------------------
< pre lang ="cs"> < span class ="code-keyword"> protected</span> < span class ="code-keyword">覆盖</span> < span class ="code-keyword"> void</span> OnTextChanged(EventArgs e)
{
< span class ="code-keyword"> base</span> .OnTextChanged(e);
< span class ="code-keyword"> foreach</span> (< span class ="code-keyword"> string</span> UnapprovedChars< span class ="code-keyword"> in</span> UnapprovedChar))
{
< span class ="code-keyword"> if</span> (< span class ="code-keyword"> this</span> .Text.Contains(UnapprovedChars))
{
< span class ="code-keyword"> this</span> .Text =< span class ="code-keyword"> this</span> .Text.Replace(UnapprovedChars,< span class ="code-SDKkeyword> String</span> .Empty);
}
}
}
}</pre>
-------------------------------------------------- ------------------



呈现为:
-------------------------------------------------- ------------------
受保护的重写void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
foreach(UnapprovedChar中的字符串UnapprovedChars)
{
如果(this.Text.Contains(UnapprovedChars))
{
this.Text = this.Text.Replace(UnapprovedChars,String.Empty);
}
}
}
-------------------------------------------------- ------------------
显然,这是不可取的.在< pre>中,空格应该很大.堵塞.我没有追究应用于< pre>内部的< span>的样式.堵塞;但是,它们不会应用于错误渲染的每一行.

知道发生了什么吗?我认为大多数人看不到吗?

When I''m viewing articles on CodeProject (in IE9), <pre> blocks render with every line left-justified. If I copy and paste the code, it seems to have the spaces, though.

EDITORS: IF YOU MAKE THESE SNIPPETS "PRETTY", THE QUESTION MAKES NO SENSE. PLEASE *READ* BEFORE CHANGING FORMATTING. THANK YOU!

For example (and without using any code block tags so as not to hide the question about the error by invoking the error!), this html:
--------------------------------------------------------------------
<pre lang="cs"> <span class="code-keyword">protected</span> <span class="code-keyword">override</span> <span class="code-keyword">void</span> OnTextChanged(EventArgs e)
{
<span class="code-keyword">base</span>.OnTextChanged(e);
<span class="code-keyword">foreach</span> (<span class="code-keyword">string</span> UnapprovedChars <span class="code-keyword">in</span> UnapprovedChar)
{
<span class="code-keyword">if</span> (<span class="code-keyword">this</span>.Text.Contains(UnapprovedChars))
{
<span class="code-keyword">this</span>.Text = <span class="code-keyword">this</span>.Text.Replace(UnapprovedChars, <span class="code-SDKkeyword">String</span>.Empty);
}
}
}
}</pre>
--------------------------------------------------------------------



Renders as:
--------------------------------------------------------------------
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
foreach (string UnapprovedChars in UnapprovedChar)
{
if (this.Text.Contains(UnapprovedChars))
{
this.Text = this.Text.Replace(UnapprovedChars, String.Empty);
}
}
}
--------------------------------------------------------------------
Clearly, this isn''t desirable. Spaces should be significant in a <pre> block. I haven''t chased down the styles being applied to the <span>s inside the <pre> block; they aren''t applied to every line that gets mis-rendered, though.

Any idea what''s going on? I assume most people don''t see this?

推荐答案

您选中了忽略HTML"复选框(在文本输入字段下).我取消选中它,并跳过了< pre>阻止您的常规文本,现在看起来很好.

如果选择 改善问题 链接,您将看到我的所作所为.
You had the "Ignore HTML" checkbox checked (under the text entry field). I unchecked it and escaped the <pre> blocks your regular text, and it looks fine now.

If you select the Improve question link, you''ll see what I did.


我在互联网上也遇到了同样的问题资源管理器9.

尝试使用Chrome.
甚至IE9的兼容模式都可以解决问题(该图标的形状像碎纸一样,位于地址栏的右侧).
I have the same issue, on Internet Explorer 9.

Try use Chrome.
Or even the compatibilty mode of IE9 should do the trick (that icon shaped like a shredded sheet of paper, near the address bar, on the right).


好.感谢您的通知.
已向CP管理员提出,他们将进行调查.
这是一个类似的线程报告: http://www.codeproject .com/Messages/3866045/Indents-Missing-from-PRE-blocks-in-IE9.aspx [
Ok. Thanks for informing.
This has been raised to CP Admins and they will look into it.
This is a similar thread reported: http://www.codeproject.com/Messages/3866045/Indents-Missing-from-PRE-blocks-in-IE9.aspx[^]


这篇关于我可以停止CodeProject上的块以使其左对齐吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆