1
votes

I've been trying to remove the tab character using Liquid string filters to no avail. I have content that comes in from mixed sources so removing the tabs from the source won't be a solution. If it matters, this is in preparation for a Jekyll static site.

Here is my liquid script:

"article" : "{{ post.content | markdownify | strip_html | strip_newlines | strip | escape_once | remove: '\[' | remove: '\t' | replace: '\ ', ' ' | remove: '\]' | remove: '\(' | remove: '\)' }}"

You can see here that I'm trying a few things to be able to remove it. I feel like I've tried all of the filters and I can't find a way to strip this character from my posts. When I copy this character over to a hex editor, it's 09, which I understand is the Horizontal Tab character. I know that I could likely resolve this issue by passing the html line-by-line, but I wanted to see if there was a small adjustment that I could make to get his to remove or replace this tab character.

1

1 Answers

4
votes

I'm a little confused but you just wanted to remove the tab character, right?

If this is the case here are few options:

1) Simple remove filter:

{% assign foo = 'foo bar' | remove: " " %}

2) Using replace:

{% assign foo = 'foo bar' | replace: " ", '' %}

3) Using split + join:

{% assign foo = 'foo bar' | split: " " | join: ' ' %}