Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

markup inside a <code> block should be ignored. #94

Closed
imaginator opened this issue Jun 12, 2013 · 3 comments
Closed

markup inside a <code> block should be ignored. #94

imaginator opened this issue Jun 12, 2013 · 3 comments

Comments

@imaginator
Copy link

Running tidyHTML complains about the contents inside of a tag.

Ideally it should ignore this code entirely.

For example:

<li><a>XML</a></li>
<p>Retrieve all posts from "alice@example.com":
GET /alice@example.com/content/posts</p>
<pre class="prettyprint">
<code class="xml">
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Alice's posts</title>
  <entry>
    <id>foo</id>
    <author>
      <name>alice@example.com</name> 
      <id>acct:alice@example.com</id>
    </author>
    <published>2012-06-01T12:00:00Z</published>
    <content>This is my newest post!</content>
  </entry>
  <entry>
    <id>bar</id>
    <author>
      <name>alice@example.com</name> 
      <id>acct:alice@example.com</id>
    </author>
    <published>2012-05-31T12:00:00Z</published>
    <content>June starts tomorrow.</content>
  </entry>
  <entry>
    <id>baz</id>
    <author>
      <name>alice@example.com</name> 
      <id>acct:alice@example.com</id>
    </author>
    <published>2012-05-30T12:00:00Z</published>
    <content>Feeling good today!</content>
  </entry>
</feed>
@geoffmcl
Copy link
Contributor

Thanks for your post...

As you may know the current development branch is develop-500
$ git checkout develop-500
and issues can only be tested against this...

Tidy does understand 'something' about pre and code, and
passes my small sample, input5\in_94-2.html, taken from the W3C site -
http://www.w3.org/TR/html5/text-level-semantics.html#the-code-element

<!DOCTYPE html>
<head>
<meta charset=utf-8>
<title>markup inside a code block should be ignored. #94</title>
</head>
<body>
<pre><code class="language-pascal">var i: Integer;
begin
   i := 1;
end.</code></pre>
</body>
</html>

This passes through tidy without problems, and the W3C validators...

However, I can not find any W3C documentation that says
"markup inside a code block should be ignored", and
expanding the above closer to what is in your sample,
input5\in_94-3.html, yields validator error, as in tidy -

<!DOCTYPE html>
<head>
<meta charset=utf-8>
<title>markup inside a code block should be ignored. #94</title>
</head>
<body>
<pre>
<code class="xml">
<feed xmlns="http://www.w3.org/1999/xhtml">
  <title>Alice's posts</title>
  <entry>
    <id>foo</id>
    <author>
      <name>alice@example.com</name> 
      <id>acct:alice@example.com</id>
    </author>
    <published>2012-06-01T12:00:00Z</published>
    <content>This is my newest post!</content>
  </entry>
</feed>
</code>
</pre>
</body>
</html>

Validator says:
Error: Element feed not allowed as child of element code in this context.

Tidy5 says:
line 9 column 1 - Error: <feed> is not recognized!
etc...

So I have to ask what are you expecting here? Can you construct a
small sample that passes the W3C validators, and FAILS in Tidy5?
This would be a Tidy bug ;=))

@balthisar
Copy link
Member

That's invalid HTML, and looks like the old IE xml data islands except for the use of feed instead of xml tag.

If instead you're trying to display the content of the code block (rather than trying to have the browser render that code), then that's not the purpose of a code block; it doesn't just display code literally. You'll have to turn it into HTML.

I'll close this. Feel free to reopen this if you have an explanation that we're failing to understand.

@balthisar
Copy link
Member

Oops. Meant to close this 9 days ago, but didn't receive any feedback from @imaginator and so will close it now. Please feel free to reopen the issue if you come back. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants