Tip:
Highlight text to annotate it
X
If we look at the description here and we scroll down to the bottom, we see this box
near the bottom that says 'Text format.' And we have a selector here. Now we've been skipping
this up until this point so we could take a moment to really talk about what this is
and how to use it.
So we have a couple of options here, filtered HTML and plain text. And if we look at the
bullet points underneath it, it will give us some tips about this text format. It says,
'Web page addresses and email addresses turn into links automatically,' and then there's
a list of allowed HTML tags: the a tag, em, strong, cite, blockquote, code, ul, ol, li,
dl, dt, and dd. And then it says, 'Lines and paragraphs break automatically.'
So just from reading this, you probably have a sense of what a text format is. It's a way
to take the content that we put inside of this box here and output it in a unique way.
For example, if we have a link in the text that points to a certain page but we haven't
used any HTML around it, it says that that will automatically be turned into a link.
That's pretty cool.
Also, we've made a break between these two items in the text and it says here that lines
and paragraphs break automatically, which is also useful. If we were working with just
plain text here, even though we have a break inside of the text area, in HTML that break
wouldn't mean anything, and so you'd see these two lines run together.
But because of this, the paragraphs are being created automatically, and the HTML that would
go between here, the break tags for example, are being inserted automatically. This is
also doing a bit of cleanup, so we can put HTML inside of here, but it says that we only
have a certain range of allowed HTML tags. And if you look at this list, you'll see that
a is here but our image tag is not, so what happens in this case is that any content within
those tags are removed and cleaned out from this output.
So what's the big idea? Why are only certain HTML tags allowed by default?
Well, there's two roles to these text formats, one of which is enhancing the output. So for
example, text containing links will get converted to the links automatically, and lines and
paragraphs will break automatically. So we're enhancing the output. We're taking a certain
amount of input and we're adding some details to it to make the process of creating the
content easier.
The second side of a text format is that is prevents abuse. So this filtered HTML format
is a text format that anybody can use on this site. So if, for example, you enable comments
on the site, and we say we have a tour content but we do want people to be able to comment
on it so we can answer questions that people have, this filtered HTML text format is the
one that people will use by default.
And we don't want them to be able to put in anything they want to. Most of the people
leaving legitimate comments won't be doing anything strange or out of the ordinary, but
we have to worry about spammers. So this condition that only certain HTML tags are allowed, allows
us to create some buffer against certain types of tags that will take over our site, for
example. In addition, for the people who are creating legitimate content, sometimes we
don't want them to get too creative. For example, we don't want them changing the look and feel
of the page by adding styles inside of the HTML. So we can be restrictive not only to
prevent spam and certain types of attacks on the site, but to also prevent our users
from being too creative and breaking the look and feel of the site as well.