Skip to content

docs: explain replacement function callbacks - #1092

Open
sridharkalaibala wants to merge 1 commit into
showdownjs:developfrom
sridharkalaibala:docs/replacement-callback
Open

sridharkalaibala wants to merge 1 commit into
showdownjs:developfrom
sridharkalaibala:docs/replacement-callback

Conversation

@sridharkalaibala

Copy link
Copy Markdown

Summary

Documents how to use a function as replace in legacy lang/output extensions: callback arguments, return value, global matching, and the distinction from filter. Adds a complete example that transforms two captured words while preserving the existing recommendation to use listener extensions for new code.

Fixes #1033.

Validation

  • Executed the documented example against the source-built Showdown bundle; verified both replacements and unchanged nonmatching text.
  • Checked callback arguments, optional/named captures, match offset, and literal $1 return behavior against that bundle.
  • npm test: 3,174 tests passed; lint has zero errors and one existing unused-variable warning in decodeEntities.js.
  • Strict MkDocs build passed; verified the generated section, example output, and filter link.
  • git diff --check passed.

This branch has not been deployed

No deployments
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.

1 participant