replace sphinx 'code' directive with 'doctest'

fixes issue #4100
Merge pull request #4109 from dmwm/sphinx_fixes

replace sphinx 'code' directive with 'doctest'