Aristotle Pagaltzis | 7 Jun 2008 17:42
Picon
Picon
Gravatar

Re: mkhtml.py: writing HTML documents in Markdown

[Note to markdown-discuss readers: for context see
<http://lists.canonical.org/pipermail/kragen-hacks/2008-June/000488.html>]

* Kragen Javier Sitaker <kragen <at> pobox.com> [2008-06-07 09:40]:
> Stylesheeting comes naturally. I just put a `<style>` element
> at the top with a few lines inside of it to format nicely.

Note that Markdown ends up wrapping `<link>` and `<style>`
in `<p>` tags, arguably erroneously. Weirdly, it looks like
Python-Markdown should avoid that mistake:

* <http://babelmark.bobtfish.net/?markdown=%3Cstyle%3Efoo+%7B%7D%3C%2Fstyle%3E>
* <http://babelmark.bobtfish.net/?markdown=%3Clink+%2F%3E>

But at the top of <http://canonical.org/~kragen/crywrap.html> the
problem shows up anyway.

Of course, neither tag has any business being in the HTML body;
they should both be in the head. Since you’re loading
BeautifulSoup anyway, you probably want to include that as fix-up
step in your postprocessing.

Regards,
--

-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>
_______________________________________________
Markdown-Discuss mailing list
Markdown-Discuss <at> six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss
(Continue reading)

Waylan Limberg | 8 Jun 2008 04:34
Picon
Gravatar

Re: mkhtml.py: writing HTML documents in Markdown

On Sat, Jun 7, 2008 at 11:42 AM, Aristotle Pagaltzis <pagaltzis <at> gmx.de> wrote:
> [Note to markdown-discuss readers: for context see
> <http://lists.canonical.org/pipermail/kragen-hacks/2008-June/000488.html>]
>
> * Kragen Javier Sitaker <kragen <at> pobox.com> [2008-06-07 09:40]:
>> Stylesheeting comes naturally. I just put a `<style>` element
>> at the top with a few lines inside of it to format nicely.
>
> Note that Markdown ends up wrapping `<link>` and `<style>`
> in `<p>` tags, arguably erroneously. Weirdly, it looks like
> Python-Markdown should avoid that mistake:

Well, first of all, he's using an old version of Python-Markdown. The
first line of his `render` function gives it away (due to the change
in 1.7 to all-unicode -- you generally don't pass unicode text to
str())

        body = str(markdown.Markdown(text))

Just use the wrapper (all lowercase in any version):

        body = markdown.markdown(text)

IIRC, there was a bugfix in 1.7 that also addressed the raw html
wrapped in <p> tags thing. So, upgrade to 1.7 and that problem should
go away.

--

-- 
----
Waylan Limberg
(Continue reading)

Aristotle Pagaltzis | 8 Jun 2008 20:19
Picon
Picon
Gravatar

Re: mkhtml.py: writing HTML documents in Markdown

* Kragen Javier Sitaker <kragen <at> canonical.org> [2008-06-08 18:00]:
> On Sat, 7 Jun 2008 17:42:53 +0200, Aristotle Pagaltzis wrote:
> > * Kragen Javier Sitaker <kragen <at> pobox.com> [2008-06-07 09:40]:
> > > Stylesheeting comes naturally. I just put a `<style>`
> > > element at the top with a few lines inside of it to format
> > > nicely.
> > 
> > Note that Markdown ends up wrapping `<link>` and `<style>` in
> > `<p>` tags, arguably erroneously.
> 
> What, is Markdown supposed to know that those elements are
> neither block-level nor span-level markup?

In fact it is – or to phrase the statement more appropriately, it
is supposed to know that wrapping such elements in `<p>` tags is
not a useful thing to do. It already avoids wrapping block-level
tags in paragraphs; there is no reason not to extend that list to
also contain all the elements that may appear in the head of an
HTML document, even though they are nominally invalid in the body.

> > Of course, neither tag has any business being in the HTML
> > body; they should both be in the head. Since you’re loading
> > BeautifulSoup anyway, you probably want to include that as
> > fix-up step in your postprocessing.
> 
> Yeah, I've been planning to do that, but didn't get around to
> doing it before sending it out.  (I also have this theory that
> I'll be a happier person if I don't spend too much time on
> inventing private markup languages, and that makes me perhaps
> unreasonably reluctant to add extra postprocessing steps, even
(Continue reading)

Kragen Javier Sitaker | 9 Jun 2008 19:24
Picon
Favicon

Re: mkhtml.py: writing HTML documents in Markdown

On Sat, 7 Jun 2008 22:34:30 -0400, Waylan Limberg wrote:
> Well, first of all, he's using an old version of Python-Markdown.

Yes, 1.4-2, the version that's in Debian Etch.  System administration
is not really a favorite hobby of mine; I tend to stick with the
versions of things in my distribution unless I have a good reason to
upgrade.

> The first line of his `render` function gives it away (due to the
> change in 1.7 to all-unicode -- you generally don't pass unicode
> text to str())
> 
>         body = str(markdown.Markdown(text))
> 
> Just use the wrapper (all lowercase in any version):
> 
>         body = markdown.markdown(text)

Thanks!

Kragen

Kragen Javier Sitaker | 9 Jun 2008 19:24
Picon
Favicon

Re: mkhtml.py: writing HTML documents in Markdown

On Sun, 8 Jun 2008 20:19:39 +0200, Aristotle Pagaltzis wrote:
> * Kragen Javier Sitaker <kragen <at> canonical.org> [2008-06-08 18:00]:
> > (I also have this theory that
> > I'll be a happier person if I don't spend too much time on
> > inventing private markup languages, and that makes me perhaps
> > unreasonably reluctant to add extra postprocessing steps, even
> > when the alternative is ill-formed HTML.)
> 
> I agree with that theory, which is why I use Markdown despite the
> minor (and a few less minor) things I dislike about it. Attaching
> some light postprocessing to Markdown to add support for small
> missing bits seems like a much better approach to achieve both
> satisfaction and an absence of unhappiness.

Agreed, especially if there's some graceful degradation.

> I try to write code only when I can’t help it…

I try to accumulate code I have to maintain only when I can't help it.
Writing code, however, is fun, and I probably reinvent the wheel quite
a bit.

Michel Fortin | 22 Jun 2008 04:27
Gravatar

[ANN] PHP Markdown 1.0.1m & Extra 1.2.2

Here's another update to PHP Markdown and PHP Markdown Extra featuring  
some bug fixes.

See the download link on the project's page:
<http://michelf.com/projects/php-markdown/>

This update also features a new emphasis parser which process regular  
and strong emphasis in one pass instead of two and four for previous  
versions of PHP Markdown and PHP Markdown Extra. The new parser is  
also faster and easier to change if the logic needs to be adjusted. It  
works by using context-dependent composition of a regular expression  
for matching allowed emphasis tokens, and PHP code to generate proper  
emphasis elements from the tokens.

1.0.1m:

*	Lists can now have empty items.

*	Rewrote the emphasis and strong emphasis parser to fix some issues
	with odly placed and overlong markers.

Extra 1.2.2:

*	Fixed a problem where abbreviation definitions, footnote
	definitions and link references were stripped inside
	fenced code blocks.

*	Fixed a bug where characters such as `"` in abbreviation
	definitions weren't properly encoded to HTML entities.

(Continue reading)


Gmane