Skip to content

Commit

Permalink
chore: simplify text filtering statement
Browse files Browse the repository at this point in the history
  • Loading branch information
3y3 committed Jul 12, 2024
1 parent a7db697 commit e171006
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/skeleton/rules/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ export const text: Renderer.RenderRuleRecord = {
text: function (tokens: Token[], i: number) {
const token = tokens[i];

if (token?.generated !== 'liquid' && token.content) {
const tokenizer = new Liquid(token.content);
const liquidTokens = tokenizer.tokenize();
if (token.reflink) {
return '';
}

if (liquidTokens.length > 1 || liquidTokens[0].type !== 'text') {
tokens.splice(i, 1, ...liquidTokens);
}
if (token?.generated !== 'liquid' && token.content) {
tokens.splice(i, 1, ...new Liquid(token.content).tokenize());
}

return '';
Expand Down

0 comments on commit e171006

Please sign in to comment.