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: render markdown formatting in list items #3135

Merged

Conversation

ilandikov
Copy link
Collaborator

@ilandikov ilandikov commented Oct 21, 2024

Types of changes

Done by pairing with @claremacrae

Changes visible to users:

  • Bug fix (prefix: fix - non-breaking change which fixes an issue)

Description

  • call MarkdownRenderer.renderMarkdown(...); for list item description render

Motivation and Context

Reproduction:

  1. Create a file called Test File with Nested List Items.md
  2. Paste in this content
# Test File with Nested List Items

- [ ] #task *Do* they give **credit**?
    - I am **bold** text
    - I am *italic* text
    - I am a link to my own file [[Test File with Nested List Items]]

```tasks
path includes {{query.file.path}}
show tree
hide backlinks
```
  1. View in Reading Mode or Live Preview

Result: The formatting characters in list items are displayed rather than being rendered:

Note: We should add a #tag sample too, to ensure that tags are rendered

How has this been tested?

  • manual test in demo vault

Screenshots (if appropriate)

image

Checklist

  • My code follows the code style of this project and passes yarn run lint.
  • My change has adequate Unit Test coverage.

Terms

@ilandikov ilandikov added scope: rendering of tasks How the plugin displays tasks (except CSS issues) scope: sub-tasks and super-tasks nested/parent/child: controlling their display, filtering them, and similar labels Oct 21, 2024
Copy link

function findClosestParentTask(listItem: ListItem) {
// Try to find the closest parent that is a task
let closestParentTask = listItem.parent;
while (closestParentTask !== null && !(closestParentTask instanceof Task)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I expect that if we changed the instanceof to something like closestParentTask.constructor.name === 'Task' we will remove the cyclic dependency problem (I think) we had when trying to move this code to ListItem.ts.

@claremacrae claremacrae merged commit 01d4cdc into obsidian-tasks-group:main Oct 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: rendering of tasks How the plugin displays tasks (except CSS issues) scope: sub-tasks and super-tasks nested/parent/child: controlling their display, filtering them, and similar
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants