Provided are benzimidazole and pyridine derivative compounds of the general formula (I) or (II), wherein the variables are as defined in the specification. Examples of the compounds include (E)-2-chloro-N-(4-chloro-3-(5-(3-(hydroxyamino)-3-oxoprop-1-enyl)pyridin-2-yl)phenyl)-4-(methylsulfonyl)benzamide and 2-((3-(4-Chloro-3-(5-(dimethylamino)-1H-benzo[d]imidazol-2-yl)phenylcarbamoyl)-5-methoxybenzyl)(methyl)amino)-N-hydroxypyrimidine-5-carboxamide. The compounds contain zinc binding moieties and can inhibit histone deacetylase (HDAC) and the hedgehog pathway. The compounds may be useful in the treatment of cancer, psoriasis or macular degeneration.