Add functions for ensuring blank lines before and after point

New functions markdown-ensure-blank-line-before and
markdown-ensure-blank-line-after.

Use new functions in markdown-insert-hr.
Improve header insertion functions

* Ensure blank lines before and after headers.
* Setext header insertion will prompt for header title when there
  is no active region.
* Generalize setext header insertion command to avoid repetition.
Use newer use-region-p when checking for active region.

Combine and simplify compatibility wrappers for XEmacs
and older Emacsen.
Add tests for blank line before and after functions

Do not move the point in markdown-ensure-blank-line-after.