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

Match <!--more--> in addition to <!-- more --> #2397

Merged
merged 4 commits into from
Jan 7, 2024
Merged

Conversation

clarfonthey
Copy link
Contributor

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Are you doing the PR on the next branch?

I noticed this when trying to migrate a few WriteFreely posts to Zola. WriteFreely uses <!--more--> when added via the rich-text editor, whereas Zola was picky about the spaces around the tags. I replaced the check with a regex so that spaces and case don't matter any more.

@Keats
Copy link
Collaborator

Keats commented Jan 2, 2024

Can you add a test?

@clarfonthey
Copy link
Contributor Author

clarfonthey commented Jan 3, 2024

Sorry for taking a bit to get to this-- a lot of my focus was on trying to get my particular static site setup working, and I was just submitting PRs for the changes I made that I thought would be reasonable to upstream.

I added some tests directly to the markdown parser, since it seems that most of the current summary-splitting tests are in the content itself. This way, it's a little closer to a unit test than an integration test.

Unfortunately, newline-split <!-- more --> would not work under this setup due to the way pulldown-cmark works, and I filed a bug to see if upstream would be interested in fixing this. But at least for now, allowing extra spaces between the more tags, and case-insensitivity, seems like a net improvement.

I also apologise that the test code is a little weird, adding in trims instead of detecting newlines between paragraph tags, but I figured that this would be more resilient in case the parser were to change to remove those.

components/markdown/src/markdown.rs Outdated Show resolved Hide resolved
@Keats Keats merged commit 682447e into getzola:next Jan 7, 2024
5 checks passed
@clarfonthey clarfonthey deleted the more branch January 7, 2024 20:23
veluca93 pushed a commit to veluca93/zola that referenced this pull request May 14, 2024
* Match <!-- more --> without spaces

* Add tests for new <!-- more --> handling, with a note on pulldown-cmark bug
Keats pushed a commit that referenced this pull request Jun 20, 2024
* Match <!-- more --> without spaces

* Add tests for new <!-- more --> handling, with a note on pulldown-cmark bug
berdandy pushed a commit to berdandy/azola that referenced this pull request Sep 17, 2024
* Match <!-- more --> without spaces

* Add tests for new <!-- more --> handling, with a note on pulldown-cmark bug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants