diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html
index c6fc663e..5ab196fd 100755
--- a/lib/github/commands/rest2html
+++ b/lib/github/commands/rest2html
@@ -236,6 +236,26 @@ class GitHubHTMLTranslator(HTMLTranslator):
def depart_table(self, node):
self.body.append('\n')
+ def visit_image(self, node):
+ """Custom visit_image for using the HTML align attribute for
+ image alignment, since css-classes will be stripped.
+ """
+ HTMLTranslator.visit_image(self, node)
+ if self.body[-1].startswith('' % align
+ self.body[-1] = self.body[-1].replace(old, new)
+
def depart_image(self, node):
uri = node['uri']
ext = os.path.splitext(uri)[1].lower()
diff --git a/test/markups/README.rst b/test/markups/README.rst
index ad7af380..129e2a33 100644
--- a/test/markups/README.rst
+++ b/test/markups/README.rst
@@ -86,6 +86,8 @@ someone@somewhere.org
Press :kbd:`Ctrl+C` to quit
+.. image:: foo.png
+ :align: right
.. raw:: html
diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html
index 7a0f8327..c2416a02 100644
--- a/test/markups/README.rst.html
+++ b/test/markups/README.rst.html
@@ -136,4 +136,5 @@
Press Ctrl+C to quit
-RAW HTML!
p {color:blue;} \ No newline at end of file +RAW HTML!
p {color:blue;}