-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert compiletime syntax configuration settings to runtime flags #124
Comments
I have absolutely no objection to pulling configure-time options out and making them into flags. If you want to make a patch that runtimifies everything, I will happily accept it and merge it into the mainline code. (note that USER_FLAGS masks out the upper 4 bits; I don't think I use them for anything right now, so it's not a problem to make USER_FLAGS 0x3FFFFFFF) |
Instead of specifying `./configure.sh --with-dl=both`, specify `-fdlextra` or `MKD_DLEXTRA` at runtime.
This change is more invasive and difficult for me as not all existing preprocessor directives directly translate to `if () {}`. Instead of passing `--with-fenced-code` to `configure.sh`, now use `MKD_FENCEDCODE` or `-ffencedcode`. The output of `markdown -VV` will now display `FENCEDCODE` if the feature is enabled and `!FENCEDCODE` if it is disabled rather than displaying `FENCED-CODE` if the feature is enabled.
Now specify flag `-fidanchor` or `MKD_IDANCHOR` instead of `./configure.sh --with-id-anchor`. In `markdown -VV` displays as `IDANCHOR` or `!IDANCHOR` rather than `ID-ANCHOR`.
Instead of `./configure.sh --with-github-tags`, specify `-fgithubtags` or `MKD_GITHUBTAGS`. Shows up in `markdown -VV` as `GITHUBTAGS` instead of `GITHUB-TAGS` now.
Instead of `./configure.sh --with-urlencoded-anchor`, now use `-furlencodedanchor` or `MKD_URLENCODEDANCHOR`.
Instead of specifying `./configure.sh --with-dl=both`, specify `-fdlextra` or `MKD_DLEXTRA` at runtime.
This change is more invasive and difficult for me as not all existing preprocessor directives directly translate to `if () {}`. Instead of passing `--with-fenced-code` to `configure.sh`, now use `MKD_FENCEDCODE` or `-ffencedcode`. The output of `markdown -VV` will now display `FENCEDCODE` if the feature is enabled and `!FENCEDCODE` if it is disabled rather than displaying `FENCED-CODE` if the feature is enabled.
Now specify flag `-fidanchor` or `MKD_IDANCHOR` instead of `./configure.sh --with-id-anchor`. In `markdown -VV` displays as `IDANCHOR` or `!IDANCHOR` rather than `ID-ANCHOR`.
Instead of `./configure.sh --with-github-tags`, specify `-fgithubtags` or `MKD_GITHUBTAGS`. Shows up in `markdown -VV` as `GITHUBTAGS` instead of `GITHUB-TAGS` now.
Instead of `./configure.sh --with-urlencoded-anchor`, now use `-furlencodedanchor` or `MKD_URLENCODEDANCHOR`.
#124: Convert much compiletime configuration to runtime flags
No need to leave this open because binki fixed the wagon for me! Thanks! |
To make discount more usable as a shared tool and library, I think it would be better if all syntax variations could be configured at runtime. If the tool needs to be used to process different types of markdown on the same system, it should be possible to access all of the different syntax variations through the tool as long as it is compiled with support for that. For example, if I run
./configure.sh --with-fenced-code
, I should be able to opt out of fences withmarkdown -f -fencedcode
rather than having to compile a different binary with./configure.sh
.For reference, this is my conclusion when considering gentoo bug #554520.
This would help a lot with the case where discount is installed system-wide and used by multiple different applications or scripts for different purposes. I suspect that some applications might even want to be able to use different options or allow the user to enable/disable them at runtime, but there are quite a few options that remain compiletime.
It looks like there are 23 flags right now, so with the max at 31 there should be enough for all of the
./configure.sh
options (6: dldiscout, dlextra, idanchor, githubtags, fencedcode, urlencodedanchor leaves flag values 30 and 31 open). If you’d be willing to accept a patch with this change, I think I could manage to write one, just let me know. I would drop all of the the relevant flags from./configure.sh
and expose them only as flags. Unfortunately, this would be a breaking change for anyone who has used./configure.sh
to customize discount before, but I think trying to keep compatibility would be unnecessarily dirty.The text was updated successfully, but these errors were encountered: