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

$site.pages summary contains invalid markdown #2657

Closed
1 task done
maxigimenez opened this issue Oct 12, 2020 · 5 comments
Closed
1 task done

$site.pages summary contains invalid markdown #2657

maxigimenez opened this issue Oct 12, 2020 · 5 comments
Labels
need feedback Awaiting author response

Comments

@maxigimenez
Copy link

  • I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

The summary provided on this.$site.pages can contain a broken markdown.

We are facing this issue on https://theheadless.dev when the summary is trimmed based on the configured characters there could be scenarios where the markdow is not valid anymore (please check the image attached).

In our case, we are setting a max length of 120 characters (summaryLength config), and the text of the image above is:

The [HyperText Transfer Protocol (HTTP)](https://developer.mozilla.org/en-US/docs/Web/HTTP#:~:text=Hypertext%20Transfer%20Protocol%20(HTTP)%20is,be%20used%20for%20other%20purposes.) is stateless, but cookies allow it to keep context consistent over the course of a session. In other words, by having our browser automatically exchange small amounts of data, we get to have websites recognise us and remember our preferences, the contents of our shopping baskets or the fact that we had just logged in to our account.

BTW this is a public repo, so feel free to check the configuration here https://github.com/checkly/theheadless.dev

What is expected?

Option A) before trimming, remove the markdown from the summary
Option B) trim the text without counting markdown characters, so it ensures that is always valid.

What is actually happening?

As attached below, the markdown is invalid so it looks weird.

Other relevant information

Screenshot 2020-10-12 at 12 21 10

@d-pollard d-pollard added the type: bug Something isn't working label Oct 12, 2020
@d-pollard
Copy link
Collaborator

d-pollard commented Oct 12, 2020

Hello @maxigimenez !

This seems to look like an API you guys have augmented your theme with here: https://github.com/checkly/theheadless.dev/blob/master/blog/.vuepress/theme/index.js#L6

I suspect the issue here might be with remove-markdown, but since I personally haven't implemented this, this is just an educated guess

@d-pollard d-pollard added need feedback Awaiting author response and removed type: bug Something isn't working labels Oct 12, 2020
@d-pollard
Copy link
Collaborator

Screen Shot 2020-10-12 at 4 36 37 PM

Have confirmed, is an issue with remove-markdown

@maxigimenez
Copy link
Author

Thank you @d-pollard! Wasn't aware of that file in our configuration.

@d-pollard
Copy link
Collaborator

No problem! Am interested in how you guys fix it, feel free to update and tag me here @maxigimenez

@maxigimenez
Copy link
Author

@d-pollard We fix our logic to trim the summary checkly/theheadless.dev#84 to be done after the remove-markdown is trigger.
Also we escape the () for %28/29 on the example above to prevent issues with remove-markdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need feedback Awaiting author response
Projects
None yet
Development

No branches or pull requests

2 participants