Skip to content

How do I replace a specific part of a converted string? #3467

Answered by UziTech
spifory asked this question in Q&A
Discussion options

You must be logged in to vote

Do you want to change the href in the middle of marked outputting html? In that case I would use use walkTokens to look for link tokens and update the href accordingly.

If you actually only want link tokens to generate html, you can update all other renderers to just output the raw text instead of html.

const renderer = {
  heading(token) {
    return token.raw;
  },
  ...
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@spifory
Comment options

Answer selected by spifory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants