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

Spec missusing the samp tag? #1364

Closed
felixsanz opened this issue Jun 1, 2016 · 6 comments
Closed

Spec missusing the samp tag? #1364

felixsanz opened this issue Jun 1, 2016 · 6 comments

Comments

@felixsanz
Copy link
Contributor

felixsanz commented Jun 1, 2016

https://html.spec.whatwg.org/multipage/semantics.html#the-samp-element

The samp element represents sample or quoted output from another program or computing system.


This second example shows a block of sample output. Nested samp and kbd elements allow for the styling of specific elements of the sample output using a style sheet. There's also a few parts of the samp that are annotated with even more detailed markup, to enable very precise styling. To achieve this, span elements are used.

<pre><samp><span class=​"prompt">jdoe@​mowmow:​~$</span> <kbd>ssh demo.example.com</kbd>
Last login:​ Tue Apr 12 09:​10:​17 2005 from mowmow.example.com on pts/1
Linux demo 2.6.10-grsec+gg3+e+fhs6b+nfs+gr0501+++p3+c4a+gr2b-reslog-v6.189 #1 SMP Tue Feb 1 11:​22:​36 PST 2005 i686 unknown

<span class=​"prompt">jdoe@​demo:​~$</span> <span class=​"cursor">_</span></samp></pre>

I'm curious here. Samp tags represent output from another program. But the ssh command is not output actually, it's input.

So i would only wrap the above as this:

<pre><samp>
Last login:​ Tue Apr 12 09:​10:​17 2005 from mowmow\.example\.com on pts/1
Linux demo 2\.6\.10\-grsec\+gg3\+e\+fhs6b\+nfs\+gr0501\+\+\+p3\+c4a\+gr2b\-reslog\-v6\.189 
</samp></pre>

Why? Because as i said, the commands like ssh are actually input and they are generated by the human. Those bits are not output from computer.

The same as if you run this command:

node -e "console.log('foo')"

That is javascript that prints "foo" in screen. foo is the output and should be wrapped inside samp tags. But the above bits are input so i would use a <code> tag for it, and use something like language-shell, or bash, or whatever (i'm not sure about the correct "language" of command execution/interpreters).

But definitely not output, and i think abusing the output tag <samp> to show input it's a bad decission and should be modified in the spec.

@felixsanz felixsanz changed the title "This second example shows a block of sample out..." Spec abusing the samp tag? Discuss Jun 1, 2016
@felixsanz felixsanz changed the title Spec abusing the samp tag? Discuss Spec missusing the samp tag? Discuss Jun 1, 2016
@felixsanz felixsanz changed the title Spec missusing the samp tag? Discuss Spec missusing the samp tag? Jun 1, 2016
@domenic
Copy link
Member

domenic commented Jun 1, 2016

Interesting find!

I think the program in question is the console, not ssh itself. This appears to be a sample of a console session, not a sample of ssh output.

It might be worth adding a note, or even a third example, clarifying this. E.g. modify the existing example to say "... a block of sample output from a console session", then adding a third example saying something like

The above example used samp to denote the output of a console session, as that was the program under discussion. In the following example, the ssh command is under discusison, and so only its output is marked up with samp:

<p>When you use the <kbd>ssh</kbd> command, you'll see output similar to the following as its first line, after entering <kbd>ssh demo.example.com</kbd>:</p>
<pre><samp>Last login: Tue Apr 12 09:10:17 2005 from mowmow.example.com on pts/1</samp></pre>

What do you think?

@felixsanz
Copy link
Contributor Author

That looks great and i agree that the program is the console, not the commands itself.

The more interesting use case for the <samp> tag (for me) is something like this:

<pre>
<code class="language-javascript">console.log(2.3 + 2.4)</code>
<samp>4.699999999999999</samp>
</pre>

@domenic
Copy link
Member

domenic commented Jun 1, 2016

Yeah, that makes sense to me. Are you interested in working on a pull request to work on some mashup of my suggestion and your example?

@felixsanz
Copy link
Contributor Author

I'm going to try, but my english kinda sucks and writing specs is even harder. Give me a few minutes for the PR :)

@felixsanz
Copy link
Contributor Author

felixsanz commented Jun 1, 2016

#1368

I hope this looks good.

@felixsanz
Copy link
Contributor Author

felixsanz commented Jun 1, 2016

By the way here is how i style samp tags in my blog. Almost no one uses samp tags, but i hope that changes :)

Code + Samp

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

No branches or pull requests

2 participants