Forum mangles code in CODE tags

This happens in both input formats:

wget hxxp://launchpad.net/plone/3.2/3.2.2/+download/Plone-3.2.2-UnifiedInstaller.tgz
tar -zxf Plone-*

written with h t t p, it becomes

wget http://launchpad.net/plone/3.2/3.2.2/+download/Plone-3.2.2-UnifiedInstaller.tgz
tar -zxf Plone-*
<a href="http://launchpad.net/plone/3.2/3.2.2/+download/Plone-3.2.2-UnifiedInstaller.tgz
tar" title="http://launchpad.net/plone/3.2/3.2.2/+download/Plone-3.2.2-UnifiedInstaller.tgz
tar">http://launchpad.net/plone/3.2/3.2.2/+download/Plone-3.2.2-UnifiedInstal...</a> -zxf Plone-*

In Filtered mode: .* is replaced by < em > inside code tags

Obviously anything enclosed in code tags should not be touched at all by the interpreter.

(its even hard to post this as it gets mangled)

Status: 
Active

Comments

Joe's picture
Submitted by Joe on Mon, 06/08/2009 - 05:24 Pro Licensee

Thanks for the heads up.

Looks like the markdown filter isn't quite doing right. I believe you can escape * by appending a backslash in front of it. Just a guess, though, as I haven't actually spent a huge amount of time with this Markdown filter (Markdown is quite nice when it works right...reddit uses it, and it works really well).

Joe's picture
Submitted by Joe on Sun, 06/14/2009 - 03:51 Pro Licensee

I don't think I did anything, but I was able to use code tags successfully earlier today, including wrapping things that have * in them.

Here's an example, just to be sure I'm not imagining it:

Testing
******
****Tested!

Yep, looks fine.

So...I'm not sure what you're seeing that's wrong behavior. Are you using < and > for your code tag wrappers?

ronald's picture
Submitted by ronald on Sun, 06/14/2009 - 03:59 Pro Licensee

the comment system isn't very friendly. Instead of just typing a message, now have to program a message :( even for a line break one had to use html < br / >

Joe's picture
Submitted by Joe on Sun, 06/14/2009 - 04:06 Pro Licensee

Are you switching to some other input format? The default format of Markdown does not require any coding at all for all common stuff.

To get a new paragraph, you hit enter twice (just like you would when writing a letter or something in plain text).

I thought Markdown was the most wonderful thing I'd ever seen when I first started using it on reddit. Now I'm absolutely addicted, and can't stand it when I have to use anything else.

ronald's picture
Submitted by ronald on Sun, 06/14/2009 - 04:14 Pro Licensee

Par exampIe: I switch to filtered html if I want to show a list. The Markdown setting will just make 1 line of my list, using < li > tags,
why are the buttons gone? a click is much faster to work with, click quote, paste, done...next.

overall I like the new site, seems faster too.

Joe's picture
Submitted by Joe on Sun, 06/14/2009 - 04:21 Pro Licensee

Lists are way easier in Markdown:

  • one item
  • and another!

But, now I see that the CSS is making the bullets invisible! How crappy... I'll fix that.

Anyway, unordered lists are built like:

- one item
- and another!

And order lists are built like:

1. Number 1
2. And 2

Which renders as:

  1. Number 1
  2. And 2

Which the CSS is also destroying. How stupid. Anyway that's the fault of the theme, not the Markdown filter. If you look at the source, you'll see that these are UL and OL elements.

Isn't that nicer than writing a bunch of tags? (A WYSIWYG editor might be OK, if they ever worked right.)

ronald's picture
Submitted by ronald on Sun, 06/14/2009 - 04:32 Pro Licensee

How does Markdown text know that I putting in a quote or code? I assume by me writing tags. Like I did with the li tags. How does it know I want my text in Bold? by writing tags. Or Italic, same.

Joe's picture
Submitted by Joe on Sun, 06/14/2009 - 04:36 Pro Licensee

Bold and italics in Markdown can be done with tags or with the same characters you'd use to indicate bold or italics in an email (** or *). So, this bit is bold and this bit is italics.

The point of Markdown is to look pretty sane without any processing, and then processing can make it look better. This has the benefit of being really fast to write with, really easy to get right in email (though apparently we're getting it wrong, anyway, but I'll fix that soon), and readable even when you're looking at a plain text rendering of the data.

Mostly, I just like writing in it a lot better than tags. I've gotten hooked on it because of sites like reddit and Hacker News that only use Markdown.

Joe's picture
Submitted by Joe on Sun, 06/14/2009 - 04:38 Pro Licensee

But, I've left filtered HTML available for folks that prefer that sort of thing, or don't want to learn yet another markup (that's a valid argument, though Markdown is as simple as markup can possibly be and still do something). And in Markdown mode, almost all of the filtered HTML markup will also work inline and without having to do anything special.

ronald's picture
Submitted by ronald on Sun, 06/14/2009 - 05:02 Pro Licensee

with the same characters you'd use to indicate bold or italics in an email I have nice buttons in my email. :)

Im pretty sure Im not the only user who has never heard of these markup, let alone how to use it. This 3 lines took me ages cause I can't get this < quote > to work neither this [ quote ] in either way filtered or markdown The first sentence is in a quote, o well nvm, we'll hop along. shift+enter doesn't work either to start a new line. I vote for 4 buttons quote, code, bold and em

Hi Joe,

I like Markdown, its certainly more user friendly than BBcode. Its also one more thing to learn, when using it for the first time.

But the implementation you're using on this site is not working quite right. Using the default Markdown format with the CODE tag still completely changes anything with h t t p in it:

wget http://launchpad.net/plone/3.2/3.2.2/+download/Plone-3.2.2-UnifiedInstaller.tgz
tar -zxf Plone-*

but it should look like this:

wget h t t p://launchpad.net/plone/3.2/3.2.2/+download/Plone-3.2.2-UnifiedInstaller.tgz
tar -zxf Plone-\*

-*  The 'minus asterisk' is still getting turned into em tags in some places

(without the extra spaces)

Shouldn't you be able to paste any code into code tags without having to worry about escaping or encoding some characters? I cannot spend the time to proof read pasted code and fix errors introduced by the markdown engine. As it is now, any code-samples I paste will be quite unusable for others unless they are meticulously cleaned up.

Christian

Joe's picture
Submitted by Joe on Sun, 06/14/2009 - 11:35 Pro Licensee

Oh, I see! Yes, that's definitely a bug.

I'll also see about getting a WYSIWYG editor that understands Markdown, or at least doesn't destroy it.

Joe's picture
Submitted by Joe on Sun, 06/14/2009 - 12:03 Pro Licensee

OK, after digging a bit deeper, I think it's not actually a bug in the Markdown processor, but in the Drupal link converter, though it might just be the order in which things are being processed currently.