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: Unexpected blank line. #704

Closed
Erimus-Koo opened this issue May 5, 2023 · 18 comments · Fixed by #706
Closed

Bug: Unexpected blank line. #704

Erimus-Koo opened this issue May 5, 2023 · 18 comments · Fixed by #706
Labels
bug Something isn't working reproducible resolution/update-made A change has been made that should resolve this issue or request

Comments

@Erimus-Koo
Copy link

### 調査企画書 BEFORE

**【状況理解(背景)】**
  - 事業上どのような課題があるのか
  - 調査結果からどのようなアクションをしたいのか  
**【問い(目的)】**
  - 何を明らかにするのか  
**【対象】**
  - どのような人を対象にするか  
### 調査企画書 AFTER

**【状況理解(背景)】**

  - 事業上どのような課題があるのか
  - 調査結果からどのようなアクションをしたいのか  
**【問い(目的)】**
  - 何を明らかにするのか  
**【対象】**
  - どのような人を対象にするか  

A blank line will be inserted after row 3 (【状況理解(背景)】).
Prettier won't add it.

And if you need the settings, please let me know which file contains it.

@Erimus-Koo Erimus-Koo added the bug Something isn't working label May 5, 2023
@Erimus-Koo
Copy link
Author

Linter/data.json

{
  "ruleConfigs": {
    "Remove Space around Fullwidth Characters": {
      "Ensures that fullwidth characters are not followed by whitespace (either single spaces or a tab). Note that this may causes issues with markdown format in some cases.": false
    },
    "escape-yaml-special-characters": {
      "enabled": false,
      "try-to-escape-single-line-arrays": false
    },
    "format-tags-in-yaml": {
      "enabled": true
    },
    "format-yaml-array": {
      "enabled": false,
      "alias-key": true,
      "tag-key": true,
      "default-array-style": "single-line",
      "default-array-keys": true,
      "force-single-line-array-style": "",
      "force-multi-line-array-style": ""
    },
    "insert-yaml-attributes": {
      "enabled": false,
      "text-to-insert": "mindmap-plugin: basic"
    },
    "move-tags-to-yaml": {
      "enabled": false,
      "how-to-handle-existing-tags": "Nothing",
      "tags-to-ignore": ""
    },
    "remove-yaml-keys": {
      "enabled": false,
      "yaml-keys-to-remove": ""
    },
    "yaml-key-sort": {
      "enabled": true,
      "yaml-key-priority-sort-order": "",
      "priority-keys-at-start-of-yaml": true,
      "yaml-sort-order-for-other-keys": "Ascending Alphabetical"
    },
    "yaml-timestamp": {
      "enabled": true,
      "date-created": true,
      "date-created-key": "date created",
      "force-retention-of-create-value": false,
      "date-modified": true,
      "date-modified-key": "date modified",
      "format": "YYYY-MM-DD HH:mm:ss"
    },
    "yaml-title": {
      "enabled": false,
      "title-key": "title"
    },
    "yaml-title-alias": {
      "enabled": false,
      "preserve-existing-alias-section-style": true,
      "keep-alias-that-matches-the-filename": false,
      "use-yaml-key-to-keep-track-of-old-filename-or-heading": true
    },
    "capitalize-headings": {
      "enabled": false,
      "style": "Title Case",
      "ignore-case-words": false,
      "ignore-words": "macOS, iOS, iPhone, iPad, JavaScript, TypeScript, AppleScript",
      "lowercase-words": "via, a, an, the, and, or, but, for, nor, so, yet, at, by, in, of, on, to, up, as, is, if, it, for, to, with, without, into, onto, per"
    },
    "file-name-heading": {
      "enabled": true
    },
    "header-increment": {
      "enabled": true,
      "start-at-h2": false
    },
    "footnote-after-punctuation": {
      "enabled": false
    },
    "move-footnotes-to-the-bottom": {
      "enabled": false
    },
    "re-index-footnotes": {
      "enabled": false
    },
    "convert-bullet-list-markers": {
      "enabled": true
    },
    "emphasis-style": {
      "enabled": false,
      "style": "consistent"
    },
    "no-bare-urls": {
      "enabled": false
    },
    "ordered-list-style": {
      "enabled": false,
      "number-style": "ascending",
      "list-end-style": "."
    },
    "proper-ellipsis": {
      "enabled": false
    },
    "remove-consecutive-list-markers": {
      "enabled": true
    },
    "remove-empty-list-markers": {
      "enabled": true
    },
    "remove-hyphenated-line-breaks": {
      "enabled": true
    },
    "remove-multiple-spaces": {
      "enabled": true
    },
    "strong-style": {
      "enabled": true,
      "style": "asterisk"
    },
    "two-spaces-between-lines-with-content": {
      "enabled": true
    },
    "unordered-list-style": {
      "enabled": true,
      "list-style": "-"
    },
    "compact-yaml": {
      "enabled": true,
      "inner-new-lines": false
    },
    "consecutive-blank-lines": {
      "enabled": true
    },
    "convert-spaces-to-tabs": {
      "enabled": false,
      "tabsize": "2"
    },
    "empty-line-around-blockquotes": {
      "enabled": false
    },
    "empty-line-around-code-fences": {
      "enabled": false
    },
    "empty-line-around-tables": {
      "enabled": false
    },
    "heading-blank-lines": {
      "enabled": true,
      "bottom": true,
      "empty-line-after-yaml": true
    },
    "line-break-at-document-end": {
      "enabled": true
    },
    "paragraph-blank-lines": {
      "enabled": true
    },
    "remove-empty-lines-between-list-markers-and-checklists": {
      "enabled": false
    },
    "remove-link-spacing": {
      "enabled": false
    },
    "space-after-list-markers": {
      "enabled": true
    },
    "space-between-chinese-japanese-or-korean-and-english-or-numbers": {
      "enabled": true
    },
    "trailing-spaces": {
      "enabled": false,
      "twp-space-line-break": false
    },
    "force-yaml-escape": {
      "enabled": false,
      "force-yaml-escape-keys": ""
    },
    "headings-start-line": {
      "enabled": false
    },
    "remove-trailing-punctuation-in-heading": {
      "enabled": false,
      "punctuation-to-remove": ".,;:!。,;:!"
    },
    "auto-correct-common-misspellings": {
      "enabled": false,
      "ignore-words": ""
    },
    "empty-line-around-math-blocks": {
      "enabled": false
    },
    "move-math-block-indicators-to-their-own-line": {
      "enabled": false
    },
    "remove-space-around-characters": {
      "enabled": false,
      "include-fullwidth-forms": true,
      "include-cjk-symbols-and-punctuation": true,
      "include-dashes": true,
      "other-symbols": ""
    },
    "add-blockquote-indentation-on-paste": {
      "enabled": false
    },
    "prevent-double-checklist-indicator-on-paste": {
      "enabled": false
    },
    "prevent-double-list-item-indicator-on-paste": {
      "enabled": false
    },
    "proper-ellipsis-on-paste": {
      "enabled": false
    },
    "remove-hyphens-on-paste": {
      "enabled": false
    },
    "remove-leading-or-trailing-whitespace-on-paste": {
      "enabled": false
    },
    "remove-leftover-footnotes-from-quote-on-paste": {
      "enabled": false
    },
    "remove-multiple-blank-lines-on-paste": {
      "enabled": false
    }
  },
  "lintOnSave": true,
  "recordLintOnSaveLogs": false,
  "displayChanged": true,
  "settingsConvertedToConfigKeyValues": true,
  "foldersToIgnore": [],
  "linterLocale": "en",
  "logLevel": 4,
  "lintCommands": [
    {
      "id": null,
      "name": ""
    }
  ],
  "customRegexes": [],
  "commonStyles": {
    "aliasArrayStyle": "single-line",
    "tagArrayStyle": "single-line",
    "minimumNumberOfDollarSignsToBeAMathBlock": 2,
    "escapeCharacter": "\""
  }
}

@pjlewisuk
Copy link

I'm also experiencing this since Linter updated a couple of days ago, e.g.

My meeting template looks like this:

Screenshot 2023-05-05 104014

But after saving the file with Linter enabled, I get extra lines added in multiple places:

Screenshot 2023-05-05 104024

If I remove these lines, Linter adds them back. Have had to disable Linter for now as it's ruining the formatting of my notes.

@pjlewisuk
Copy link

Here's my .obsidian/plugins/obsidian-linter/data.json config file:

{
  "ruleConfigs": {
    "Remove Space around Fullwidth Characters": {
      "Ensures that fullwidth characters are not followed by whitespace (either single spaces or a tab). Note that this may causes issues with markdown format in some cases.": false
    },
    "escape-yaml-special-characters": {
      "enabled": false,
      "try-to-escape-single-line-arrays": false
    },
    "force-yaml-escape": {
      "enabled": false,
      "force-yaml-escape-keys": ""
    },
    "format-tags-in-yaml": {
      "enabled": false
    },
    "format-yaml-array": {
      "enabled": false,
      "alias-key": true,
      "tag-key": true,
      "default-array-style": "single-line",
      "default-array-keys": true,
      "force-single-line-array-style": "",
      "force-multi-line-array-style": ""
    },
    "insert-yaml-attributes": {
      "enabled": false,
      "text-to-insert": "aliases: \ntags: "
    },
    "move-tags-to-yaml": {
      "enabled": false,
      "how-to-handle-existing-tags": "Nothing",
      "tags-to-ignore": ""
    },
    "remove-yaml-keys": {
      "enabled": false,
      "yaml-keys-to-remove": ""
    },
    "yaml-key-sort": {
      "enabled": false,
      "yaml-key-priority-sort-order": "",
      "priority-keys-at-start-of-yaml": true,
      "yaml-sort-order-for-other-keys": "None"
    },
    "yaml-timestamp": {
      "enabled": true,
      "date-created": true,
      "date-created-key": "created_date",
      "force-retention-of-create-value": false,
      "date-modified": true,
      "date-modified-key": "updated_date",
      "format": "DD/MM/YYYY HH:mm"
    },
    "yaml-title": {
      "enabled": false,
      "title-key": "title"
    },
    "yaml-title-alias": {
      "enabled": false,
      "preserve-existing-alias-section-style": true,
      "keep-alias-that-matches-the-filename": false,
      "use-yaml-key-to-keep-track-of-old-filename-or-heading": true
    },
    "capitalize-headings": {
      "enabled": false,
      "style": "Title Case",
      "ignore-case-words": true,
      "ignore-words": "macOS, iOS, iPhone, iPad, JavaScript, TypeScript, AppleScript",
      "lowercase-words": "via, a, an, the, and, or, but, for, nor, so, yet, at, by, in, of, on, to, up, as, is, if, it, for, to, with, without, into, onto, per"
    },
    "file-name-heading": {
      "enabled": true
    },
    "header-increment": {
      "enabled": true,
      "start-at-h2": false
    },
    "headings-start-line": {
      "enabled": true
    },
    "remove-trailing-punctuation-in-heading": {
      "enabled": false,
      "punctuation-to-remove": ".,;:!。,;:!"
    },
    "footnote-after-punctuation": {
      "enabled": false
    },
    "move-footnotes-to-the-bottom": {
      "enabled": false
    },
    "re-index-footnotes": {
      "enabled": false
    },
    "auto-correct-common-misspellings": {
      "enabled": false,
      "ignore-words": ""
    },
    "convert-bullet-list-markers": {
      "enabled": true
    },
    "emphasis-style": {
      "enabled": true,
      "style": "asterisk"
    },
    "no-bare-urls": {
      "enabled": false
    },
    "ordered-list-style": {
      "enabled": true,
      "number-style": "ascending",
      "list-end-style": "."
    },
    "proper-ellipsis": {
      "enabled": false
    },
    "remove-consecutive-list-markers": {
      "enabled": false
    },
    "remove-empty-list-markers": {
      "enabled": false
    },
    "remove-hyphenated-line-breaks": {
      "enabled": false
    },
    "remove-multiple-spaces": {
      "enabled": true
    },
    "strong-style": {
      "enabled": true,
      "style": "asterisk"
    },
    "two-spaces-between-lines-with-content": {
      "enabled": true
    },
    "unordered-list-style": {
      "enabled": true,
      "list-style": "-"
    },
    "compact-yaml": {
      "enabled": true,
      "inner-new-lines": false
    },
    "consecutive-blank-lines": {
      "enabled": true
    },
    "convert-spaces-to-tabs": {
      "enabled": true,
      "tabsize": "2"
    },
    "empty-line-around-blockquotes": {
      "enabled": false
    },
    "empty-line-around-code-fences": {
      "enabled": false
    },
    "empty-line-around-math-blocks": {
      "enabled": false
    },
    "empty-line-around-tables": {
      "enabled": false
    },
    "heading-blank-lines": {
      "enabled": true,
      "bottom": true,
      "empty-line-after-yaml": true
    },
    "line-break-at-document-end": {
      "enabled": true
    },
    "move-math-block-indicators-to-their-own-line": {
      "enabled": false
    },
    "paragraph-blank-lines": {
      "enabled": true
    },
    "remove-empty-lines-between-list-markers-and-checklists": {
      "enabled": true
    },
    "remove-link-spacing": {
      "enabled": true
    },
    "remove-space-around-characters": {
      "enabled": false,
      "include-fullwidth-forms": true,
      "include-cjk-symbols-and-punctuation": true,
      "include-dashes": true,
      "other-symbols": ""
    },
    "space-after-list-markers": {
      "enabled": true
    },
    "space-between-chinese-japanese-or-korean-and-english-or-numbers": {
      "enabled": false
    },
    "trailing-spaces": {
      "enabled": false,
      "twp-space-line-break": false
    },
    "add-blockquote-indentation-on-paste": {
      "enabled": false
    },
    "prevent-double-checklist-indicator-on-paste": {
      "enabled": false
    },
    "prevent-double-list-item-indicator-on-paste": {
      "enabled": false
    },
    "proper-ellipsis-on-paste": {
      "enabled": false
    },
    "remove-hyphens-on-paste": {
      "enabled": false
    },
    "remove-leading-or-trailing-whitespace-on-paste": {
      "enabled": false
    },
    "remove-leftover-footnotes-from-quote-on-paste": {
      "enabled": false
    },
    "remove-multiple-blank-lines-on-paste": {
      "enabled": true
    }
  },
  "lintOnSave": true,
  "recordLintOnSaveLogs": false,
  "displayChanged": true,
  "settingsConvertedToConfigKeyValues": true,
  "foldersToIgnore": [
    "Extras/Templates/",
    ""
  ],
  "linterLocale": "system-default",
  "logLevel": 4,
  "lintCommands": [],
  "customRegexes": [],
  "commonStyles": {
    "aliasArrayStyle": "single-line",
    "tagArrayStyle": "single-line",
    "minimumNumberOfDollarSignsToBeAMathBlock": 2,
    "escapeCharacter": "\""
  }
}

@pjkaufman
Copy link
Collaborator

I'm also experiencing this since Linter updated a couple of days ago, e.g.

My meeting template looks like this:

Screenshot 2023-05-05 104014

But after saving the file with Linter enabled, I get extra lines added in multiple places:

Screenshot 2023-05-05 104024

If I remove these lines, Linter adds them back. Have had to disable Linter for now as it's ruining the formatting of my notes.

I will need the source for before and after linting if I am going to be able to do anything about that potential issue.

@pjlewisuk
Copy link

pjlewisuk commented May 5, 2023

Sure.

Before:

---
id: test
created_date: 05/05/2023 12:06
updated_date: 05/05/2023 12:06
---

**Date:** [[2023-05-05-Friday]]

# test

## Attendees

- 

## Agenda

- 

## Notes

- 

## Actions

- [ ] 

^actions

After:

---
id: test
created_date: 05/05/2023 12:06
updated_date: 05/05/2023 12:07
---

**Date:** [[2023-05-05-Friday]]

# test

## Attendees


- 

## Agenda


- 

## Notes


- 

## Actions

- [ ] 

^actions

It seems to be (incorrectly) adding a blank line after the heading, and another blank line before the lists...

@pjkaufman
Copy link
Collaborator

Sure.

Before:

---
id: test
created_date: 05/05/2023 12:06
updated_date: 05/05/2023 12:06
---

**Date:** [[2023-05-05-Friday]]

# test

## Attendees

- 

## Agenda

- 

## Notes

- 

## Actions

- [ ] 

^actions

After:

---
id: test
created_date: 05/05/2023 12:06
updated_date: 05/05/2023 12:07
---

**Date:** [[2023-05-05-Friday]]

# test

## Attendees


- 

## Agenda


- 

## Notes


- 

## Actions

- [ ] 

^actions

It seems to be (incorrectly) adding a blank line after the heading, and another blank line before the lists...

Thanks for providing the examples. I will take a look and see what I can do. It may be that it is incorrectly matching the new table identification logic, but that would be odd. Hopefully I can get this fixed relatively quickly.

@pjkaufman
Copy link
Collaborator

I do see a newline being added to the following example:

### 調査企画書 BEFORE

**【状況理解(背景)】**
  - 事業上どのような課題があるのか
  - 調査結果からどのようなアクションをしたいのか  
**【問い(目的)】**
  - 何を明らかにするのか  
**【対象】**
  - どのような人を対象にするか  

I am looking to see what rule could be causing it.

@pjkaufman
Copy link
Collaborator

Looks like paragraph blank lines is affecting the above example. I need to verify that it is actually a paragraph. If that is the case, then it is working as expected, but if the paragraph just includes the one line, then it is not working as expected.

@pjkaufman
Copy link
Collaborator

Looks like according to the AST parser, the one line is the only one as part of the blank lines. I need to go ahead and fix that issue.
https://astexplorer.net/#/gist/111c4f5728f9c80696a9422a7c9c99f0/aa4f9e212560494d7ebb5d826e6777137afa59d1

@pjkaufman
Copy link
Collaborator

As a side note, I am not sure what Prettier has to do with the Linter @Erimus-Koo , but I would be careful comparing its logic with the Logic used here in the Linter as they are not related and not consulted when writing the logic here.

This comment is in reference to:

A blank line will be inserted after row 3 (【状況理解(背景)】).
Prettier won't add it.

@pjkaufman
Copy link
Collaborator

pjkaufman commented May 5, 2023

Looking at the underlying logic and how a paragraph is defined in the Linter, the following is correct behavior, @Erimus-Koo .

Before:

### 調査企画書 BEFORE

**【状況理解(背景)】**
  - 事業上どのような課題があるのか
  - 調査結果からどのようなアクションをしたいのか  
**【問い(目的)】**
  - 何を明らかにするのか  
**【対象】**
  - どのような人を対象にするか  

After:

### 調査企画書 AFTER

**【状況理解(背景)】**

  - 事業上どのような課題があるのか
  - 調査結果からどのようなアクションをしたいのか  
**【問い(目的)】**
  - 何を明らかにするのか  
**【対象】**
  - どのような人を対象にするか  

Edit: a paragraph is a line that starts with a letter or character and is continued until a line does not end in either 2 or more spaces or a line break html element.

Edit 2: To prevent this, you can turn off paragraph blank lines.

@pjkaufman
Copy link
Collaborator

I should probably add an example with how you can ignore adding a blank line for that rule, but it is working as intended.

@pjkaufman
Copy link
Collaborator

Sure.

Before:

---
id: test
created_date: 05/05/2023 12:06
updated_date: 05/05/2023 12:06
---

**Date:** [[2023-05-05-Friday]]

# test

## Attendees

- 

## Agenda

- 

## Notes

- 

## Actions

- [ ] 

^actions

After:

---
id: test
created_date: 05/05/2023 12:06
updated_date: 05/05/2023 12:07
---

**Date:** [[2023-05-05-Friday]]

# test

## Attendees


- 

## Agenda


- 

## Notes


- 

## Actions

- [ ] 

^actions

It seems to be (incorrectly) adding a blank line after the heading, and another blank line before the lists...

This looks to be affected by the same rule which is odd. But I guess that it may be a bug that I need to work out. I need to figure out why paragraph blank lines seems to be affecting more than it should with regards to this scenario.

@pjkaufman
Copy link
Collaborator

The new table parsing seems to be incorrectly identifying that empty list marker as a table. I will need to adjust the logic to make sure that does not happen.

@pjkaufman
Copy link
Collaborator

I believe I have a fix for the scenario provided by @pjlewisuk . The other scenario seems to be working as expected, so I plan to close this bug when I merge in the PR with the fix for the table identification. It should take care of the reported issue while the other is simply turning off a rule.

@pjkaufman
Copy link
Collaborator

This issue with table recognition that was determined by @pjlewisuk's example has been fixed on master and in the next release. Please let us know if that is not the case.

The potential issue mentioned by @Erimus-Koo , is actually expected behavior for paragraph blank lines and can be prevented by turning that rule off.

@pjkaufman pjkaufman added resolution/update-made A change has been made that should resolve this issue or request reproducible labels May 5, 2023
@pjlewisuk
Copy link

@pjkaufman Thanks for addressing this so quickly, I look forward to the next update!

@pjkaufman
Copy link
Collaborator

No problem. I am glad it could get addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproducible resolution/update-made A change has been made that should resolve this issue or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants