arturadib / strapdown

Instant and elegant Markdown documents in the browser
http://strapdownjs.com
MIT License
2.48k stars 410 forks source link

XMP tag has been deprecated since HTML3.2 #40

Open jamesmortensen opened 10 years ago

jamesmortensen commented 10 years ago

I found this library to be very useful, and one of my colleagues used it to help us build API documentation that didn't require us to replace all of the > and < with &gt; and &lt. In fact, I see it as a competitor to static-site generator tools like Jekyll, Octopress, and DocPad. In fact, that's exactly what we did with our API documentation. we used Strapdown.js to create a static page.

However, it recently came to my attention that <xmp has been deprecated since HTML3.2.

Should you consider using a non-deprecated tag in this library, such as <pre> or <code> as suggested by the Mozilla HTML documentation on XMP?

Note: Do not use this element.

  • It has been deprecated since HTML3.2 and was not implemented in a consistent way. It was completely removed from the language in HTML5.
  • Use the <pre> element or, if semantically adequate, the <code> element instead. Note that you will need to escape the '<' character as '&lt;' to make sure it is not interpreted as markup.
  • A monospaced font can also be obtained on any element, by applying an adequate CSS style using monospace as the generic-font value for the font-family property.
ghost commented 9 years ago

I think the deprecation of the <xmp> tag makes the tag unique for Strapdown.js ... ∩(︶▽︶)∩

binarez commented 8 years ago

http://stackoverflow.com/a/10830811

jamesmortensen commented 8 years ago

Except it doesn't make it unique. It simply leaves the library open to undefined behavior as described in the Stack Overflow link. If everyone decided to go out and make up their own tags, then the Internet would be a mess. There is nothing I see special or unique about Strapdown.js that isn't special or unique about some other library or tool that does use semantically correct markup.

If there is a good reason for this, it would be interesting to hear. I'm not against the idea of making up tags in practice, as long as it's not just because of ignorance of how HTML works.

tortoise74 commented 8 years ago

For reference "undeprecating" the

tag for the benefit of strapdown and others was rejected by w3 (in 2013) as wont fix. See <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=12235#c15">https://www.w3.org/Bugs/Public/show_bug.cgi?id=12235#c15</a></p> <p>Would a sensible way forward be to support a custom tag based on <pre> as an alternate syntax?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/binarez"><img src="https://avatars.githubusercontent.com/u/390934?v=4" />binarez</a> commented <strong> 8 years ago</strong> </div> <div class="markdown-body"> <p>Wouldn't it just work to use a div? I'm no html expert but it seems like that is what most libs do, no? Le 5 janv. 2016 7:35 PM, &quot;tortoise74&quot; notifications@github.com a écrit :</p> <blockquote> <p>For reference &quot;undeprecating&quot; the <xmp> tag for the benefit of strapdown and others was rejected by w3 (in 2013) as wont fix. See <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=12235#c15">https://www.w3.org/Bugs/Public/show_bug.cgi?id=12235#c15</a></p> <p>Would a sensible way forward be to support a custom tag based on <pre> as an alternate syntax?</p> <p>— Reply to this email directly or view it on GitHub <a href="https://github.com/arturadib/strapdown/issues/40#issuecomment-169178700">https://github.com/arturadib/strapdown/issues/40#issuecomment-169178700</a>.</p> </blockquote> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/dotku"><img src="https://avatars.githubusercontent.com/u/1519232?v=4" />dotku</a> commented <strong> 8 years ago</strong> </div> <div class="markdown-body"> <p>It works with textarea right now</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jbenner-radham"><img src="https://avatars.githubusercontent.com/u/1311967?v=4" />jbenner-radham</a> commented <strong> 6 years ago</strong> </div> <div class="markdown-body"> <p>I know I'm late to the party but I would suggest using <code>&lt;script type="text/markdown"&gt;</code> as the container tag. This won't encode HTML entities and you won't have to set <code>display:none;</code> styling on it as well.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jamesmortensen"><img src="https://avatars.githubusercontent.com/u/1315816?v=4" />jamesmortensen</a> commented <strong> 6 years ago</strong> </div> <div class="markdown-body"> <p>That is what other libraries do which involve using different language, but I generally see that with scripting languages like Coffeescript or Brython, not markup languages.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jbenner-radham"><img src="https://avatars.githubusercontent.com/u/1311967?v=4" />jbenner-radham</a> commented <strong> 6 years ago</strong> </div> <div class="markdown-body"> <p>That's a good point. Although it's not uncommon to see markup in <code>text/x-template</code> tags for various template systems like Handlebars, Vue, etc. it's not the most semantic implementation I agree. The only other thing I could think of would be something like <code>&lt;template class="markdown"&gt;</code>.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/mookid8000"><img src="https://avatars.githubusercontent.com/u/32968?v=4" />mookid8000</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p><code>&lt;template&gt;</code> is meant for HTML code that is not readily rendered by a client, but instead leaves it in the DOM for scripts to manipulate. </p> <p>Since any content is allowed, it's an obvious candidate as an alternative to the deprecated <code>&lt;xmp&gt;</code> tag.</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>