Allow c_char options to be NULL
#237
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What the title says!
ComrakOptions::default()sets theheader_idsoption ofextensionsto""; this means that, by default, headers are always given anchor tags (with an ID matching the text content of the header).In C, there's currently no way of implementing the removal of the
header_idsoption. This won't work:Because it reads just as
defaultdoes: add the header IDs, but don't add any prefix.This PR introduces (and tests) a different possibility:
Passing this ☝️ will effectively "turn off" header ID generation by checking to see if the incoming value is
NULL. (Some kind ofNULLcheck is necessary here, with or without this change. I was able to segfault the FFI.)I'm happy to expose a different function to configure this if it doesn't look good!