In what format are you inserting it in?
JS
You tell me:
$ echo " code '<'" > foo.txt
$ cat foo.txt | Markdown.pl; # Grubers Markdown.pl
<pre><code>code '<'
</code></pre>
$ markdown foo.txt; # python-markdown
<pre><code>code '<'
</code></pre>
With your example text:
$ diff -u python.markdown gruber.markdown
--- python.markdown 2009-06-30 11:17:51.000000000 +0200
+++ gruber.markdown 2009-06-30 11:17:57.000000000 +0200
@@ -1,9 +1,14 @@
<p>foo bar</p>
+
<pre><code>some code '<'
</code></pre>
+
<p>blah foo</p>
+
<pre><code>'<more' code
</code></pre>
+
<p>baz bar</p>
+
<pre><code>blah >
-</code></pre>
\ No newline at end of file
+</code></pre>
But I agree it doesn't make sense really, if it's ending up wrapped in
<pre><code> combo browsers will afaik escape it. But you probably know
more about Markdown than I do.
JS
> I have entire sections of paragraphs completely missing from my
> documents because those sections are between code blocks with a few <
> and > signs in them. This is unacceptable and renders the Gitourious
> wiki unusable.
Waylan, first off, thanks for spelling it out like this for me
(again!), really appreciate the effort. It seems I completely
misunderstood what the issue was, I thought your beef was with the
encoding of "<" to a "<", but now I understand what you mean.
>
>> But I agree it doesn't make sense really, if it's ending up wrapped in
>> <pre><code> combo browsers will afaik escape it.
>
> Well, actually the markdown parser will take care of escaping it in a
> way that the browser can understand, but yes, no other code should be
> trying to escape the code blocks before or after markdown runs on the
> text.
Actually, the issue is that we sanitize _before_ markdownizing it. We
should allow most html as per markdown, but we want to filter out any
XSS <script>'s etc. The correct way to do it is of course to pass it
through sanitize() _after_ we've run it through markdown. I'll deploy
it to Gitorious shortly.
Another thing I think I have to do, which unfortunately isn't valid
markdown, is to convert a single newline to a <br/> tag (well,
space-space-newline and let discount make the <br>). This is something
I've gotten numerous reports from frustrated users about, and to be
honest I kinda agree with it. What's your opinion on such a change?
Cheers,
JS
I think what Johan says is to do the same (or very similar) as what
github does. Nicely explained here:
http://github.github.com/github-flavored-markdown/
--
Diego Algorta
www.oboxodo.com
I see your point on supporting the standard and I think you're right.
But github (and johan) have a point too. Maybe gitorious could support
the "github-flavored-markdown" (maybe johan can talk to the github
guys and agree to rename it as developers-flavored-markdown) as an
opt-in?
I think best option would be to have a default option at a
user/project/whatever level and then be able to override it at the
wiki page level.
What you both say?
Diego
Do they? The standard behavior not only has a benefit of being
standard, but also makes it possible to edit the files using editors
that do make it easy to work with long lines, which means nearly all
terminal editors.
Call me a nerd, but it seems to me that not being able to easily edit
the files through a terminal is such a huge minus, that I don't see
what can compensate for it. Plus, in cases where you really care about
line breaks, wouldn't you want the text to show <pre> anyway?
> guys and agree to rename it as developers-flavored-markdown) as an
More like "developers-who-do-not-believe-in-wrapping-at-78-characters-flavored-markdown".
:)
- yuri
Seems like I typed my previous email a bit too fast, I was actually
going to say that it would be limited to comments, since that's where
people tend to not think so much about the markdown format. As opposed
to wiki pages where, at least I, are more in the "markdown zone",
rather than just reacting to something and need to type it down
without worrying too much about formatting beyond links and code
snippets.
So, the newline hack would only be limited to comments, whereas the
wikipages would be standard markdown (with the sanitize fixes
discussed previously)
This makes more sense.
BTW, in either case, you might want to look into MarkItUp, which has
support for Markdown:
http://markitup.jaysalvat.com/examples/markdown/
I find it to be a good compromise, offering a toolbar with buttons for
users who want them, while allowing power users to just type in the
markup.
We've integrated it into our wiki engine (http://spu.tnik.org) with
some simple customization (adding a button for wikilinks, removing
some buttons, etc), and this was fairly straightforward.
> I just wish this worked like mediawiki or even (gasp) google code's
> wiki system. any hope of getting a better markup system than markdown
> (which seems rather incomplete) ???
Just want to mention some nice libs:
http://rubyforge.org/projects/wikicreole/
http://rubyforge.org/projects/mediacloth/