Support Vietnamsese when generating header ID #35
Support Vietnamsese when generating header ID
If this option is
This option should be used only if
Example: "Đây-là-ví-dụ" will generate new ID
The text was updated successfully, but these errors were encountered:
Thanks for this pull request!
However, adding a language-specific option like this is probably not a good thing because then kramdown would need to add options for other languages like German or French too.
The one-size-fits-all solution would be to use something like https://github.com/rsl/stringex for doing the actual transliterations. When given your example string, the same result is output. So it should work fine for Vietnamese.
A problem with using stringex is, however, that it is tailored to be used in a Rails setting - not optimal for a normal Ruby library. Therefore I would probably just include the relevant parts in kramdown and update the data files from time to time.
What this be okay for your use case?
Thank you for the feedback.
I also think that my pull would mess up the Kramdown (I can see that when writting some test cases for the pull). Something like Stringex would be much better and it can generate readable IDs that I want.
So please consider to add support for Stringex (and of course, close my pull request ;)
Thank you very much
I have written an adapted version of the decoding routine from stringex (i.e. no code from the stringex library is directly used) and the data files from stringex (I don't think that shipping that 750KiB of data with kramdown is necessary).
With these changes your stated use case works flawlessly.
Note that this won't work on Ruby <=1.8.6!