Skip to content

Excerpt not rendering markdown tags #1380

Closed
@jonathanyeong

Description

@jonathanyeong

Description
I'm getting an excerpt that contains raw markdown when I use custom front matter parsing from the docs: https://www.11ty.dev/docs/data-frontmatter-customize/.

To Reproduce

  1. Add this config to .eleventy.js
  eleventyConfig.setFrontMatterParsingOptions({
    excerpt: true,
    excerpt_separator: "<!-- excerpt -->",
    excerpt_alias: 'my_custom_excerpt'
  });
  1. Add to a markdown post that has a link [test](example.com) in the excerpt.
  2. Call the custom excerpt post.data.my_custom_excerpt.

Expected behavior
I expect the link to render as a link

Actual behavior
It renders the raw markdown.

Screenshots
Raw markdown in excerpt

This is the markdown:

Last week I wrote up a [learning plan](https://www.jonathanyeong.com/blog-posts/phoenix-elixir-learning-plan/) for Phoenix & Elixir. In this post, I wanted to add an addendum to phase 1 of the plan and give a quick progress update.

Environment:

  • Mac 10.15.6
  • Eleventy Version - 0.11.0

Additional context
There are workarounds to this issue such as creating custom shortcodes, but would love to use the frontmatter excerpt..

Another, consideration is to render the markdown and then strip the tags. Stripping the tags is seen in frameworks such as Hugo (via plainify - https://gohugo.io/functions/plainify/). And can provide a more uniform excerpt. Totally my opinion though! Feel free to ignore if it won't provide value!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions