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

fix: Dataview: Enable workarounds to prevent Obsidian from rendering inline fields as reference style links #1916

Merged

Conversation

kedestin
Copy link
Contributor

@kedestin kedestin commented Apr 26, 2023

Description

Resolves #1913

This PR is a hotfix that adds better support for the workarounds suggested in #1913, that get around Obsidian rendering sequential inline fields ([start::2023-04-25][priority::high]) as reference-style links:

Specifically this PR:

  • Relaxes some parsing rules to allow users to separate inline fields with a comma (,).
  • Makes Tasks always write Dataview tasks with 2 spaces in between fields.
  • Updates the documentation to:
    • Separate inline fields with commas in examples
    • Warn about reference style links and describe the workarounds

Note: No work was done on suggestions since users are expected to manually insert brackets (and now spaces and/or commas) themselves.

Motivation and Context

Hotfix for #1913

How has this been tested?

  • A test was added to validate that comma separated fields are supported
  • Existing serialization tests were updated to reflect that 2 spaces are inserted instead of 1.

Screenshots (if appropriate)

Types of changes

Changes visible to users:

  • Bug fix (prefix: fix - non-breaking change which fixes an issue)
  • New feature (prefix: feat - non-breaking change which adds functionality)
  • Breaking change (prefix: feat!! or fix!! - fix or feature that would cause existing functionality to not work as expected)
  • Documentation (prefix: docs - improvements to any documentation content for users)
  • Sample vault (prefix: vault - improvements to the Tasks-Demo sample vault)
  • Contributing Guidelines (prefix: contrib - any improvements to documentation content for contributors - see Contributing to Tasks)

Internal changes:

  • Refactor (prefix: refactor - non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)
  • Tests (prefix: test - additions and improvements to unit tests and the smoke tests)
  • Infrastructure (prefix: chore - examples include GitHub Actions, issue templates)

Checklist

Terms

@kedestin kedestin force-pushed the hotfix-side-by-side-inline-fields branch from 2ceaa37 to c35fc2d Compare April 26, 2023 06:25
@kedestin kedestin force-pushed the hotfix-side-by-side-inline-fields branch from c35fc2d to f152e58 Compare April 26, 2023 06:28
@claremacrae claremacrae added the scope: parsing markdown See also 'scope: global filter' label Apr 26, 2023
@claremacrae
Copy link
Collaborator

Thank you very much indeed. I should have time to review and merge this and #1878 later today and then do a release.

@claremacrae
Copy link
Collaborator

FYI I'm going to push one or two minor edits to the docs on your branch before merge, in the interests of releasing more quickly.

I hope you don't mind.

@claremacrae
Copy link
Collaborator

I was all set to merge this but there is something going on in the formatting of the documentation that I don't understand...

  • In 2 I think the difference in colour between the fields is going to be confusing - so I would suggest making this a text block...
  • In 3, I don't understand what the <u> pair are doing
  • But in 4, the thing that really I don't understand is how come all the fields are shown in 4, when not all of them are shown in 3.

image

@claremacrae
Copy link
Collaborator

I meant to say that it would be worth recording which fix the Tasks modal uses, so people know they don't need to keep on applying the fix manually themselves...

@kedestin
Copy link
Contributor Author

kedestin commented Apr 26, 2023

  • In 2 I think the difference in colour between the fields is going to be confusing - so I would suggest making this a text block...

Will do

  • In 3, I don't understand what the <u> pair are doing

Adds an underline to mimic how Obsidian styles links. Got it from here https://forum.obsidian.md/t/is-there-a-way-to-underline-text/43745

This is what it looks like when it renders correctly.

image

  • But in 4, the thing that really I don't understand is how come all the fields are shown in 4, when not all of them are shown in 3.

I think this is a rendering bug, and I was really hoping it was just isolated to me. Didn't have time to narrow down if it was Obsidian or Tasks that was causing it. If I'm recalling correctly, editing the language tag in 2 fixed the issue for me. Unsure if this bug is reproducible in Obsidian Publish also. I can see if I can reformat that section to circumvent the issue altogether.

@claremacrae
Copy link
Collaborator

Didn't have time to narrow down if it was Obsidian or Tasks that was causing it.

Ah - I was going to say that Tasks isn't enabled in the docs vault, but actually it is...

I should remove it, to ensure that rendering in the docs is closer to that in Publish.

@kedestin
Copy link
Contributor Author

kedestin commented Apr 26, 2023

Didn't have time to narrow down if it was Obsidian or Tasks that was causing it.

Ah - I was going to say that Tasks isn't enabled in the docs vault, but actually it is...

I should remove it, to ensure that rendering in the docs is closer to that in Publish.

I think this is a bug caused by Tasks. I can reproduce this reliably by:

  • Closing Reference/Task Formats/Dataview Format.md
  • Enabling Tasks (It appears that 3.0.0 is the version currently in the docs/ vault)
  • Reloading plugins
  • Opening Reference/Task Formats/Dataview Format.md
  • Enabling reading view

Result:

image


With the following steps, the page renders as expected:

  • Closing Reference/Task Formats/Dataview Format.md
  • Disabling Tasks
  • Reloading plugins
  • Opening Reference/Task Formats/Dataview Format.md
  • Enabling reading view

Result:

image


In light of this, may not need to block the merge over it. Disabling Tasks in the docs/ vault seems to mitigate the issue.

And there's a repro in the event this requires a later investigation.

Copy link
Collaborator

@claremacrae claremacrae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this on iPhone as well, out of an abundance of caution.

@claremacrae claremacrae merged commit b1188b4 into obsidian-tasks-group:main Apr 27, 2023
@claremacrae
Copy link
Collaborator

This works really well. Thank you for a quick and thorough fix! ❤️

claremacrae added a commit that referenced this pull request Apr 27, 2023
Its rendering of task lines in docs caused confusion
and unwanted rendering in the docs during work on #1916.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: parsing markdown See also 'scope: global filter'
Projects
Status: 🎉 Released
Development

Successfully merging this pull request may close these issues.

Alternating inline fields are invisible when using Dataview Format
2 participants