Rewrite anchor generation in C

Hello,

This pull request provides an anchor generation algorithm that doesn't rely on the Ruby C API in order to address [a comment](https://github.com/vmg/redcarpet/commit/6d881e86fd5e4a6cebb8329bc3e64d163744c25d#commitcomment-6021367) regarding ports of Redcarpet to other languages. Moreover, this was far from ideal to import the whole `ruby.h` just to do some string computations.

The only drawback here is that there is a higher amount of code.

Have a nice day !