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

[WIP, Experimental] Runtime customization by application side. #249

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mity
Copy link
Owner

@mity mity commented Feb 25, 2024

This PR is an attempt to implement the proposal discussed in #245.

Rough to-do list:

  • Change API in md4c.h so that the callbacks can get custom block/span/text type IDs.
  • Change API in md4c-html.h so that application can override the output of the HTML renderer for some block/span/text types.
  • Expand MD_PARSER so that it's possible to add support for new custom span ranges.
  • Implement such custom expansion in md2html (e.g. subscript, superscript)
  • Expand MD_PARSER so that it's possible to add support for new custom auto-ending spans (name-like).
  • Implement such custom expansion in md2html (e.g. feature idea: named emoji like :wink: #183 and/or user mentions).

This version of MD_PARSER changes prototypes of callbacks enter_block(),
leave_block(), enter_span(), leave_span() and text() so that their 1st
argument is int instead of enumerations MD_BLOCK_TYPE, MD_SPAN_TYPE and
MD_TEXT_TYPE respectivelly.

The purpose if this is to enable introduction of new block, span and
text type in runtime in upcoming patches.
Also update md2html to enable this on the parser side rather than
renderer side.

Make MD_HTML_FLAG_SKIP_UTF8_BOM deprecated. md_html() converts the flag
into parser_flags.
Copy link

codecov bot commented Feb 25, 2024

Codecov Report

Attention: Patch coverage is 83.00000% with 17 lines in your changes are missing coverage. Please review.

Project coverage is 91.44%. Comparing base (3848bfb) to head (3e93dd5).

Files Patch % Lines
src/md4c-html.c 87.95% 10 Missing ⚠️
src/md4c.c 58.82% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #249      +/-   ##
==========================================
- Coverage   91.74%   91.44%   -0.30%     
==========================================
  Files           5        5              
  Lines        3366     3389      +23     
  Branches      764      765       +1     
==========================================
+ Hits         3088     3099      +11     
- Misses        278      290      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

None yet

1 participant