Skip to content

Commit

Permalink
Add start/end characters to code block replace tokens (resolve #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
zlovatt committed Jul 24, 2022
1 parent ec2bc41 commit cc7c234
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

### Fixed

-
- "Skip code blocks" failing if more than 10 code blocks present in document ( #7 )

---

Expand Down
4 changes: 2 additions & 2 deletions src/utils/searchReplaceTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function buildTokenReplaceMap(

const replacedIndex = replaced.index;
const tokenCount = textCollection.terms.length - 1;
const token = prefix + tokenCount.toString();
const token = `{{${prefix}${tokenCount.toString()}}}`;

textCollection.text =
textCollection.text.slice(0, replacedIndex) +
Expand All @@ -60,7 +60,7 @@ function replaceSwappedTokens(
terms: string[]
): string {
terms.forEach((term, ii) => {
const token = prefix + ii.toString();
const token = `{{${prefix}${ii.toString()}}}`;
text = text.replace(token, term);
});

Expand Down

0 comments on commit cc7c234

Please sign in to comment.