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

astro-fuse: Unexpected character ! #16

Open
bennycode opened this issue Apr 17, 2024 · 1 comment
Open

astro-fuse: Unexpected character ! #16

bennycode opened this issue Apr 17, 2024 · 1 comment

Comments

@bennycode
Copy link
Contributor

bennycode commented Apr 17, 2024

Thanks for building astro-fuse but when I am having it installed, my development server crashes with the following message:

YAML Exception:

Unexpected character ! (U+0021) before name, expected a character that can start a name, such as a letter, $, or _ (note: to create a comment in MDX, use {/* text */})

It doesn't like my file add-a-window-property-with-typescript.md?astroContentCollectionEntry=true with the following content:

<!-- more -->

It also doesn't like other pragmas such as <!-- prettier-ignore-start --> and {% youtube bRW5r7TK6KM 'video' false %}.

How can these be ignored by the parser?

@bennycode
Copy link
Contributor Author

I used a workaround by using an HTML extractor (extractContentFromHTML) instead of extracting the content from Markdown.

My current config:

    fuse({
      basedOn: 'output',
      extractContentFromHTML: 'main',
      filter: (pathName) => {
        const isBlog = pathName.startsWith('/blog/');
        const isCategory = pathName.startsWith('/category/');
        const isTag = pathName.startsWith('/tag/');
        return !isBlog && !isCategory && !isTag;
      },
      keys: ['frontmatter.title', 'frontmatter.description'],
    } as AstroFuseConfig)

Unfortunately, this limits my ability to extract meta data from Frontmatter.

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

No branches or pull requests

1 participant