atom.module not formatting Markdown or Textile properly

There’s a known issue with the atom.module for Drupal, which creates an Atom syndication feed to accompanying the built-in RSS feed — the issue is that if you’re also using the Markdown or Textile modules, atom.module doesn’t convert the markup to proper HTML, instead showing the Markdown or Textile as is. Like I said, this is a known issue.

After a bit of investigation, I’ve come up with a temporary solution to the problem, at least for Markdown format. (I don’t have Textile installed, so someone else will have to confirm; given the nature of the fix, I imagine it would work.)

If you check out the raw XML atom.module makes, it is creating a proper Atom file with “summary” and “content” fields. The module fills these in with the contents of the Drupal “teaser” and “body” fields respectively for each node. So far so good.

Strangely, the “teaser” field is getting formatted correctly — in other words, the Markdown markup is being converted to regular HTML, as it should be (and as it is on the regular webpage). But the “body” atom.module is using for the Atom “content” content in is the raw Markdown, sans conversion.

Spending a bit of time familiarizing myself with the system, I’ve not tracked down the exact problem (though I suspect it might be an issue with the node_invoke_nodeapi usage here), but my temporary fix is to simply replace the line (line 179 in my copy of atom.module) that reads

$output .= check_markup($item->body);

with this:

$output .= check_markup($item->teaser);

All this does is use the same command as on line 173 just above, which calls the properly formatted teaser.

This is not a permanent solution by any means, and is also at the whims of whether or not you use teasers and/or excerpts, but it takes care of things for me until the real fix is in.

UPDATE

After some more experimentation, I’ve discovered the following:

  1. atom.module apparently uses the default Input Format to display the body version of the story.
  2. If that Input Format is not Markdown-capable, the story will not display properly.
  3. If it is Markdown-capable, but certain HTML tags are forbidden, it will not display those.

Another temporary solution

Although this temporary solution isn’t for everybody, if you allow Markdown in your default Input Format, and include appropriate HTML formatting+filtering, you will take care of the problem for now.