-
Notifications
You must be signed in to change notification settings - Fork 158
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
Markdown code blocks without a type are allowed but can be misinterpreted #562
Comments
This reverts commit abbb940. Due to causing existing learning paths to fail tests. I've opened issue ArmDeveloperEcosystem#562 to discuss the larger issue here, which I did not understand when I did this change.
One way is to initialise "ncmd" to 0 here |
Debug output for some of the examples:
So you can see the second line being used as the command. |
And to be clear, if the amount of info comes off as pushy this isn't my intention. I just wanted to give as clear a picture as possible. I'm also happy to contribute the fixes myself, but being new here, I don't know what direction would be appropriate. |
Type of issue
Describe the issue
https://learn.arm.com/learning-paths/cross-platform/_example-learning-path/appendix-1-formatting/ says "You can add code snippets in the standard markdown format.".
Which is true, until you try to test a learning path and a single line block will fail because it has no commands. The first line is consumed as the "type" and then there are no lines left to be potential commands. For example:
The type becomes "Plain text goes here." with no commands attached to the block. This leads to:
Which we could fix, but I think the real issue is we should clarify how blocks should or must be tagged with a type.
There are 2 workarounds to this first problem.
text
oroutput
as the other learning paths have.However, I think that's a poor user experience especially if you're using Markdown for its wide appeal.
If we want to require that all blocks have a type line, let's decide on a set of valid type names and throw a nice informative error if one of them is not found.
If we are not going to do that and instead allow the completely standard syntax, there is a gotcha that must be mentioned. If the first line of the plain text includes a recognised type like "bash", it will run the subsequent lines as bash. For example:
Or even:
Which I think would be incredibly confusing to a new contributor.
To Reproduce
Create a learning path page with any of the blocks shown above, run the maintenance script on it.
Expected behavior
Either:
Desktop (please complete the following information):
Additional context
Original "fix" for this was #552 but this broke existing paths, so will be reverted.
The text was updated successfully, but these errors were encountered: