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 front matter rendering #3460

Merged
merged 3 commits into from
Nov 21, 2022
Merged

Fix front matter rendering #3460

merged 3 commits into from
Nov 21, 2022

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Nov 20, 2022

📝 Summary

This fixes an issue where front matters are not correctly rendered by markdown-it leading to an invalid tiptap state which is then the reason why front matters are sometimes dropped.
I also added a test for this.

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests
  • Documentation (README or documentation) has been updated or is not required

If the editor was loaded before the callback did not
write the front matter content to the correct variable
which resulted in dropping the front matter.

This is fixed by not using the callback but a renderer function.

Signed-off-by: Ferdinand Thiessen <[email protected]>
@susnux susnux added feature: formatting Features related to text formatting and node types 3. to review format: markdown labels Nov 20, 2022
@susnux susnux changed the title Fix/front matter Fix front matter rendering Nov 20, 2022
@susnux
Copy link
Contributor Author

susnux commented Nov 20, 2022

/compile

@cypress
Copy link

cypress bot commented Nov 20, 2022



Test summary

107 0 0 0Flakiness 2


Run details

Project Text
Status Passed
Commit 9175eb6 ℹ️
Started Nov 20, 2022 7:40 PM
Ended Nov 20, 2022 7:47 PM
Duration 06:26 💡
OS Linux Ubuntu -
Browser Electron 106

View run in Cypress Dashboard ➡️


Flakiness

sections.spec.js Flakiness
1 Content Sections > Heading anchors > Anchor scrolls into view
links.spec.js Flakiness
1 test link marks > link preview > shows a link preview

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

susnux and others added 2 commits November 20, 2022 20:37
1. Test if the correct front matter content is displayed
2. Test if the front matter survives closing and reopening the editor

Skip common mark tests which we correctly interpret as front matter

Signed-off-by: Ferdinand Thiessen <[email protected]>
Signed-off-by: nextcloud-command <[email protected]>
Copy link
Collaborator

@max-nextcloud max-nextcloud left a comment

Choose a reason for hiding this comment

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

Code changes look good.
Tests included and seem to cover the issue in question - so i did not test myself.

@max-nextcloud max-nextcloud merged commit 53da190 into master Nov 21, 2022
@delete-merged-branch delete-merged-branch bot deleted the fix/front-matter branch November 21, 2022 10:56
@max-nextcloud
Copy link
Collaborator

/backport 9e820c6 cfb15dc to stable25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review feature: formatting Features related to text formatting and node types format: markdown
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Frontmatter in MD files
3 participants