SVN::Notify::Filter::Markdown - Convert SVN::Notify log messages from Markdown to HTML


SVN-Notify-Filter-Markdown documentation Contained in the SVN-Notify-Filter-Markdown distribution.

Index


Code Index:

Name

Top

SVN::Notify::Filter::Markdown - Convert SVN::Notify log messages from Markdown to HTML

Synopsis

Top

Use svnnotify in post-commit:

  svnnotify --p "$1" --r "$2" --to you@example.com --handler HTML \
  --filter Markdown

Use the class in a custom script:

  use SVN::Notify;

  my $notifier = SVN::Notify->new(
      repos_path => $path,
      revision   => $rev,
      to         => 'you@example.com',
      handler    => 'HTML::ColorDiff',
      filters    => [ 'Markdown' ],
  );
  $notifier->prepare;
  $notifier->execute;

Description

Top

This module filters SVN::Notify log message output to convert it from Markdown format to HTML. Essentially, this means that if you write your commit log messages in Markdown format and like to use SVN::Notify::HTML or SVN::Notify::HTML::ColorDiff to format your commit notifications, you can use this filter to convert the Markdown formatting in the log message to HTML. Just pass --filter Markdown to your call to svnnotify in post-commit and you're good to go.

If you don't know what any of this means, read the SVN::Notify documentation. It talks about using SVN::Notify to send nicely formatted emails for every Subversion commit. This module just makes them even more nicely formatted.

See Also

Top

SVN::Notify
Text::Markdown
http://daringfireball.net/projects/markdown/

Support

Top

This module is stored in an open GitHub repository. Feel free to fork and contribute!

Please file bug reports via GitHub Issues or by sending mail to bug-SVN-Notify-Filter-Markdown@rt.cpan.org.

Author

Top

David E. Wheeler <david@justatheory.com>

Copyright and License

Top


SVN-Notify-Filter-Markdown documentation Contained in the SVN-Notify-Filter-Markdown distribution.

package SVN::Notify::Filter::Markdown;

use strict;
use Text::Markdown ();
use SVN::Notify ();
$SVN::Notify::Filter::Markdown::VERSION = '0.05';

sub log_message {
    my ($notify, $lines) = @_;
    return $lines unless $notify->content_type eq 'text/html';
    my $m = Text::Markdown->new;
    return [ $m->markdown( join $/, @{ $lines } ) ];
}

1;