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

Add Markdown Github style alerts #28

Closed
belibug opened this issue May 24, 2024 · 9 comments
Closed

Add Markdown Github style alerts #28

belibug opened this issue May 24, 2024 · 9 comments

Comments

@belibug
Copy link
Contributor

belibug commented May 24, 2024

Add markdown syntax to add github alerts like this

Note

Useful information that users should know, even when skimming content.

Github docs link

I can work on this and do pull request if you are still accepting pull requests.

@Sarafian
Copy link
Owner

Sarafian commented May 27, 2024

I always loved those from confluence era.
They are a github extension, so they won't render everywhere.
I understand how they look so much cooler, but I wonder what is your use case? Do you plan to feed it back to github?

I do accept pull requests. I've stopped working on this project for a while now. The pester engine needs first to be updated by #26 to make sure that the ci pipeline also work. Also, please be advised that everything is unit tested, maybe to a fault, and they actually take more effort than the function itself.

While answering the following occured to me:
Would you consider implementing an extension module for github extensions? MarkdownGitHubPS or GHMarkdownPS which would require MarkdownPS to function. Github can be interchanged with GH.
I see two options here as well:

  • New repository. You can also copy my entire module structure. I can also add a reference here for the this module for github extensions.
  • Add a module in this repository and modify the pipeline. This would keep everything self contained in this repository.

Thoughts?

If you would extend the current module, then what are your thoughts on the cmdlet name?

  • Extend the New-MDQuote with the -GHAlert parameter
  • Create new cmdlet New-MDGHAlert with the same syntax as with the New-MDQuote. It can actually call it to output the same thing.

@belibug
Copy link
Contributor Author

belibug commented May 29, 2024

It's relatively new even on GitHub, but given some time, it will gain traction and become widely adopted (I truly hope so). Markdown doesn't have any official standards of its own, but GitHub Flavored Markdown is quite popular. MarkdownPS is used for creating documentation and help files, with a significant portion of this content ending up on GitHub. Additionally, many static site generators now support Markdown admonition and GitHub alert styles.

My use case involves utilizing these "alert" syntaxes while creating README files or Markdown files displayed in GitHub repositories.

Introducing an extension for such a simple feature would add unnecessary complexity. It makes more sense to integrate this feature into MarkdownPS by adding it as another command or parameter.

I prefer extending the current module instead of creating an extension.

How to proceed:

  • Adding it to New-MDQuote is a good idea, but it's better to avoid modifying core Markdown features and keep these extension-type commands separate.
  • New-MDAlertQuote aligns better with the existing command naming conventions. Although it's not exclusively a GitHub feature, GitHub does promote it. Details can be included in the command's help section without being part of the command name.
  • New-MDAlertQuote should follow the same syntax as New-MDQuote with an additional parameter to choose the type of admonition.

I am eager to address issue #26. No amount of testing is too much testing, and I'm pleased to see this repository's commitment to thorough testing. Testing is often not given the importance it deserves in many PowerShell projects, at least compared to other languages.

@Sarafian
Copy link
Owner

It's relatively new even on GitHub, but given some time, it will gain traction and become widely adopted (I truly hope so). Markdown doesn't have any official standards of its own, but GitHub Flavored Markdown is quite popular. MarkdownPS is used for creating documentation and help files, with a significant portion of this content ending up on GitHub. Additionally, many static site generators now support Markdown admonition and GitHub alert styles.

Used for the same reasons so makes sense. Didn't know the static generators supported it.

I prefer extending the current module instead of creating an extension.

For now I agreed

Let me check again on the naming conventions and the "idea/spirit" behind them and I'll come back to you. The repositories were meant to be easy extensible with multiple modules.

@Sarafian
Copy link
Owner

While looking around, I found this link for the GFM specification. My goal was understand what other functions are there available . Some issues and remarks

  1. The spec is outdated and while reading more about this, it seems kind of a mess of who does what.
  2. I read here that not everywhere in github is GFM supported, so maybe double check your usage. For static websites it will be okay, but for showing in github you might have some issues. It should be double checked
  3. Seems to me that the module is already following the GFM. For example the table/list renderings seem to follow this. So, this might be a good reason to just keep everything in the same module. We just need to make sure that the readme and manifest convey this message. We should also have a section in the readme for the GFM explicit cmdlets. If we follow this pattern then the name should be New-MDAlert -Lines -Type which internally calls New-MDQuote -Lines and we can test less with just checking the mock call.

Have you found more about the spec?

@belibug
Copy link
Contributor Author

belibug commented May 29, 2024

  1. The GitHub specs seem outdated and were last updated in 2019.
  2. The GitHub documentation appears to be more current and should be referenced. Additionally, this discussion provides a changelog and markdown syntax reference applicable to GitHub.
  3. I agree that this module aligns closely with GitHub Flavored Markdown (GFM), which is one of the main reasons I became interested in it initially. I also concur with the point about reusing the New-MDQuote -Lines functionality.

@Sarafian
Copy link
Owner

So, pester is updated and ci pipeline seems to work. Let me know what you decide.

@belibug
Copy link
Contributor Author

belibug commented May 29, 2024

I have started working on New-MDAlert -Lines -Type, will first finish function and test case. Will get to documentation and other things once you validate/sign off.

@Sarafian
Copy link
Owner

Once you are ready, we'll push the changes from branch 35-expired-powershellgallery-keys along with GH-35. If I push it now, it will publish a new minor version. I think it is best to publish both fixes together. Maybe along with #27

@belibug
Copy link
Contributor Author

belibug commented May 31, 2024

I have pushed the changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants