Vuepress: $site.pages summary contains invalid markdown

Created on 12 Oct 2020  路  5Comments  路  Source: vuejs/vuepress




  • [x] 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

need feedback

All 5 comments

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

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

Have confirmed, is an issue with remove-markdown

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

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

@d-pollard We fix our logic to trim the summary https://github.com/checkly/theheadless.dev/pull/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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ederchrono picture ederchrono  路  3Comments

AleksejDix picture AleksejDix  路  3Comments

lesliecdubs picture lesliecdubs  路  3Comments

tinchox5 picture tinchox5  路  3Comments

genedronek picture genedronek  路  3Comments