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

feat: add support for other markdown file extensions #5164

Merged

Conversation

MoustaphaDev
Copy link
Member

@MoustaphaDev MoustaphaDev commented Oct 21, 2022

Changes

Closes #5148. Adds support for the following markdown file extensions:

  • .markdown
  • .mdown
  • .mkdn
  • .mkd
  • .mdwn

Testing

  • The markdown.test.js test suite was updated to include test coverage for markdown pages with the new extensions.
  • A test case in rss.test.js was updated to match the updated error message.

Docs

withastro/docs#1893

adds `.markdown` file extension support for markdown files
@changeset-bot
Copy link

changeset-bot bot commented Oct 21, 2022

🦋 Changeset detected

Latest commit: 85b625d

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) pkg: integration Related to any renderer integration (scope) labels Oct 21, 2022
@MoustaphaDev MoustaphaDev marked this pull request as ready for review October 22, 2022 00:20
@MoustaphaDev MoustaphaDev requested a review from a team as a code owner October 22, 2022 00:20
@MoustaphaDev
Copy link
Member Author

MoustaphaDev commented Oct 22, 2022

Looks like the mdx integration doesn't need a changeset, tell me I'll revert that

@mrienstra
Copy link
Contributor

One more small change needed:

packages/astro-rss/test/rss.test.js#L201

-				chai.expect(err.message).to.contain('you can only glob ".md" files within /pages');
+				chai.expect(err.message).to.contain('you can only glob ".md" or ".markdown" files within /pages');

@sarah11918
Copy link
Member

@MoustaphaDev - This looks great from the perspective of Docs-facing stuff in files for this PR!

As for what needs to go directly in Docs, I believe it should just be the markdown-content page that needs to be updated, and only where we "define" Markdown files as .md files. There are some examples that use an .md file, which can stay as is. That's the file being used as the example, and we're describing it. But, there are a handful of places where we say "Markdown (.md)..." where we should absolutely tack on .markdown as another possible option.

I even checked the Layouts page which has a Markdown Layouts section, and we only say "Markdown" (we don't mention the file extension), so I think just targeting markdown-content in the docs makes sense.

Are you willing to make a Docs PR, or do you want someone from Team Docs to take this on?

@MoustaphaDev
Copy link
Member Author

MoustaphaDev commented Oct 23, 2022

Thanks @sarah11918 for pointing me to the right direction, I will open a docs PR to include this update.

@Princesseuh
Copy link
Member

There's a few more extensions that are sometimes used for Markdown. GitHub for instance supports the following: .markdown, .mdown, .mkdn, .mkd, .mdwn, .md. I'm not sure how common they are, but maybe it'd be worth it to add them even then to avoid further issues in the future?

@MoustaphaDev
Copy link
Member Author

There's a few more extensions that are sometimes used for Markdown. GitHub for instance supports the following: .markdown, .mdown, .mkdn, .mkd, .mdwn, .md. I'm not sure how common they are, but maybe it'd be worth it to add them even then to avoid further issues in the future?

Right, better support all the options, I'll make some changes in a bit

@MoustaphaDev MoustaphaDev marked this pull request as draft October 24, 2022 17:42
@matthewp
Copy link
Contributor

Code looks very clean! Think this should be marked as minor though, which would put it at a Thursday release if ready by EOD Wednesday.

@MoustaphaDev MoustaphaDev changed the title fix: add .markdown file extension support feat: add support for multiple markdown file extensions Oct 24, 2022
@@ -58,7 +58,7 @@ function mapGlobResult(items: GlobResult): Promise<RSSFeedItem[]> {
const { url, frontmatter } = await getInfo();
if (url === undefined || url === null) {
throw new Error(
`[RSS] When passing an import.meta.glob result directly, you can only glob ".md" files within /pages! Consider mapping the result to an array of RSSFeedItems. See the RSS docs for usage examples: https://docs.astro.build/en/guides/rss/#2-list-of-rss-feed-objects`
`[RSS] When passing an import.meta.glob result directly, you can only glob ".md" (or alternative extensions for markdown files like ".markdown") files within /pages! Consider mapping the result to an array of RSSFeedItems. See the RSS docs for usage examples: https://docs.astro.build/en/guides/rss/#2-list-of-rss-feed-objects`
Copy link
Member Author

@MoustaphaDev MoustaphaDev Oct 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would cause a patch for the rss package, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think that's file.

@matthewp
Copy link
Contributor

@MoustaphaDev can you remove the Draft when you think this is ready? Thanks!

@MoustaphaDev
Copy link
Member Author

@MoustaphaDev can you remove the Draft when you think this is ready? Thanks!

Will do in a moment, I'll just add some test cases for the new extensions.

@MoustaphaDev MoustaphaDev marked this pull request as ready for review October 24, 2022 20:01
@MoustaphaDev MoustaphaDev changed the title feat: add support for multiple markdown file extensions feat: add support for other markdown file extensions Oct 24, 2022
@matthewp matthewp added the semver: minor Change triggers a `minor` release label Oct 25, 2022
Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from a docs perspective!

@matthewp matthewp merged commit 4a8a346 into withastro:main Oct 26, 2022
@MoustaphaDev MoustaphaDev deleted the add-dot-markdown-file-extension-support branch October 26, 2022 14:21
@astrobot-houston astrobot-houston mentioned this pull request Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pkg: integration Related to any renderer integration (scope) semver: minor Change triggers a `minor` release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

*.markdown doesn't seem to be supported.
6 participants