-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Suggestion: Automatically wrap code in Markdown code blocks #15
Comments
@MarkEwer So, you are proposing to add automatic insertion of code fences? Btw, are you using CsToMd or planning? |
Yes, I am suggesting automatic insertion of code fences if the default language comment is present in the file. I am evaluating CsToMd for my team as an addition to our "living documentation" setup. |
I need to think how to support both explicit and configured fences together. I don't want to redo all my existing docs for this. |
Ok, it seems too ambiguous to decide when to insert the code fence if there are already some code fences specified.
In principle, you may simplify the above code like this:
You probably don't need to worry about the |
Nice! That should work well.On Jan 20, 2025 7:38 AM, Maksim Volkau ***@***.***> wrote:
Ok, it seems too ambiguous to decide when to insert the code fence if there are already some code fences specified.
To avoid the confusion, I will introduce code:-- to stop the insertion of the fences. Example:
//md code:cs
var x = 3;
//md code:-- stop the cs fences
//md```js
const y = function() {};
//md```
//md code:cs back to cs
In principle, you may simplify the above code like this:
//md code:cs
var x = 3;
//md code:js
const y = function() {};
//md code:cs back to cs
You probably don't need to fuss about the code:-- unless you are working with the existing documentation which uses the explicit code fences, and you don't want to migrate it yet.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Situation:
When generating
.md
files from unit tests that have helper methods or sections that we don't need to appear in the documentation, like the using statements, I have been using collapsed sections to "hide" those things from display unless the person needs to drill into them. But the switching from code blocks to markdown and back as I am adding documentation is a little tedious.Suggestion:
Add a new comment tag called
//md language:{language}
that we can add near the top of the file. Having added this tag in the file, the processor can then automatically wrap all code lines in a Markdown code block using the named language. This would save the user from having to add//md ```
to every section of code in the document.Example:
As an example, consider this unit test:
Then we would get this output:
As you can see from the example, the suggestion is for the parser to identify the sections of code that are not tagged as Markdown and automatically wrap them in a Markdown code block using the default language specified at the top of the file. This enhancement would save some typing and make the unit test source code a bit easier to read.
The text was updated successfully, but these errors were encountered: