Skip to content
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

Allow user to customize generated HTML #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

strager
Copy link

@strager strager commented May 4, 2021

md_html allows very little customization. If users want to use <tt>
instead of <code>, for example, they need to reimplement md_html
entirely or post-process md_html's output.

Expose some of md_html's internals to make it easier for users to
customize md_html's output.

md_html allows very little customization. If users want to use <tt>
instead of <code>, for example, they need to reimplement md_html
entirely or post-process md_html's output.

Expose some of md_html's internals to make it easier for users to
customize md_html's output.
@codecov
Copy link

codecov bot commented May 6, 2021

Codecov Report

Merging #158 (5d4c578) into master (da77b92) will decrease coverage by 1.47%.
The diff coverage is 30.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #158      +/-   ##
==========================================
- Coverage   94.46%   92.98%   -1.48%     
==========================================
  Files           3        4       +1     
  Lines        3088     3151      +63     
==========================================
+ Hits         2917     2930      +13     
- Misses        171      221      +50     
Impacted Files Coverage Δ
src/md4c-html-example.c 0.00% <0.00%> (ø)
src/md4c-html.c 94.36% <88.00%> (-0.84%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update da77b92...5d4c578. Read the comment docs.

@mity
Copy link
Owner

mity commented Jan 6, 2022

Hello, 1st of all sorry for the very late response to this.

I find this as an interesting idea generally, but it needs some more work before I'm ready to merge this.

  1. Most importantly, the new interface in md4c-html.h would have to be re-designed in some bigger way to allow accommodating future expansion of md4c.h interface.

Imagine future version of the structure MD_PARSER gets a new (optional) member which allows using a new optional feature. The parser (md4c.c) would only use the new member and enable the feature only when MD_PARSER::abi_version >= 1 (for compatibility with current applications out there.) Completely legitimate thing to do.

But such future feature then could never be used together with md_html_create() because we could not change interface of that function so it could not be able to initialize the new struct member(s).

  1. Please avoid using C-99 and C-11 struct initializers in the code. In some cases MD4C is translated with very antique C compilers (for example Qt uses MD4C and they need to compile it for some embedded systems with obscure old C compiler).

  2. I would also prefer to move md4c-html-example.c to a new dir (e.g. md4c/examples) to not clutter the main stuff. Example serves both partly a feature of source code and partly also that of a documentation so it would probably be better from that perspective too.

@strager
Copy link
Author

strager commented Jan 12, 2022

I don't plan to work on this patch. Feel free to take it over. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants