Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: markdown filter shouldn’t remove linebreak #329

Open
Fred-Vatin opened this issue Jan 18, 2025 · 0 comments
Open

BUG: markdown filter shouldn’t remove linebreak #329

Fred-Vatin opened this issue Jan 18, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@Fred-Vatin
Copy link

Environment

  • OS: Windows
  • Browser Firefox 134.0.1
  • Web Clipper version: 0.10.5
  • Obsidian version: 1.7.7

Steps to reproduce

Install this test template:

{
  "schemaVersion": "0.1.0",
  "name": "Tweet test",
  "behavior": "create",
  "noteContentFormat": "<!-- tweet content only -->\n{{selectorHtml:article[tabindex=\"-1\"][data-testid=\"tweet\"] .css-175oi2r.r-1s2bzr4 > [data-testid=\"tweetText\"]:first-of-type|markdown}}",
  "properties": [
    {
      "name": "title",
      "value": "{{title}}",
      "type": "text"
    },
    {
      "name": "url",
      "value": "{{url}}",
      "type": "text"
    },
    {
      "name": "author",
      "value": "{{selector:article[tabindex=\\\"-1\\\"][data-testid=\\\"tweet\\\"] [data-testid=\\\"User-Name\\\"] span.css-1jxf684.r-bcqeeo.r-1ttztb7.r-qvutc0.r-poiln3|first|safe_name}}",
      "type": "text"
    },
    {
      "name": "userID",
      "value": "{{url|split:\\\"/\\\"|slice:3,4}}",
      "type": "text"
    },
    {
      "name": "profile",
      "value": "https://x.com/{{url|split:\\\"/\\\"|slice:3,4}}",
      "type": "text"
    },
    {
      "name": "image",
      "value": "{{selector:img[alt=\\\"Image\\\"]?src|first}}",
      "type": "text"
    },
    {
      "name": "published",
      "value": "{{selector:article[tabindex=\\\"-1\\\"][data-testid=\\\"tweet\\\"] a[role=\\\"link\\\"] > time?datetime}}",
      "type": "date"
    },
    {
      "name": "created",
      "value": "{{date}}",
      "type": "date"
    }
  ],
  "triggers": [
    "/^https:\\/\\/x\\.com\\/.+?\\/status\\/\\d+$/"
  ],
  "noteNameFormat": "Tweet - {{selector:article[tabindex=\"-1\"][data-testid=\"tweet\"] [data-testid=\"User-Name\"] span.css-1jxf684.r-bcqeeo.r-1ttztb7.r-qvutc0.r-poiln3|first|safe_name}} ({{selector:article[tabindex=\"-1\"][data-testid=\"tweet\"] a[role=\"link\"] > time?datetime|date:\"YYYY-MM-DD HH[h]mm\"}})",
  "path": "References/Tweets"
}

Expected result

Should return the content as displayed on the web keeping line break like this:

IF THERE AREN'T ENOUGH BABIES. THAT CHANGES EVERYTHING

The global estimate of births has been steadily declining since the 1950s, according to data from various sources like the united nations and u.s. centers for disease control.

By 2023, the global rate is projected to be 2.15, with the u.s. at 1.62 and south korea at an alarmingly low 0.72.

The trend could have profound impacts on economies, social structures, and future generations, and potentially collapsing countries.

Source: Wsj. World Economic Forum

Actual result

Returns

<!-- tweet content only -->
IF THERE AREN'T ENOUGH BABIES. THAT CHANGES EVERYTHING The global estimate of births has been steadily declining since the 1950s, according to data from various sources like the united nations and u.s. centers for disease control. By 2023, the global rate is projected to be 2.15, with the u.s. at 1.62 and south korea at an alarmingly low 0.72. The trend could have profound impacts on economies, social structures, and future generations, and potentially collapsing countries. Source: Wsj. World Economic Forum

Additional information

This issue is also mention here with sort of workaround but not as good as is the markdown filter would work as expected. We could use selector instead of selectorHtml:…|markdown but we loose url and alt img text.

@Fred-Vatin Fred-Vatin added the bug Something isn't working label Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant