-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Could the user specify number of backticks to use in snippet code blocks? #537
Comments
i think nested ticks should be escaped. thoughts? |
Oh. Interesting idea. I tried it, so that my snippet to embed now looks like:
Is that what you meant? When embedded this gets rendered as: So not quite the effect that I am after... Also, even if it rendered OK, it makes the snippet file be a little less useful, as not copy-and-pastable, reusable for testing and similar. |
'n+1' backticks really is the convention: |
Related, N+1 also works in Obsidian markdown editor, which is the tool I am writing this code for. So the lovely advantage of the generated markdown being consistent with GitHub markdown is that people who clone the repo will be able to read the docs directly. The JetBrains IDEs also render the 4 back ticks as intended. |
@claremacrae can you submit a Pull Request for that change? |
Please leave the issue open for me to look at it, as I do really want it. Unfortunately being on a Mac, JetBrains Rider is giving me a bunch of errors when I open the project. I don't have the details here, but it could be that a bunch of tools are just out of date, as it's 18 months since I did any C#. |
This would be great. I think it would be better if any snippet: text checked if it contained ``` and automatically changed itself to be ```` or rather `+1. |
Is the feature request related to a problem
Yes.
Summary
Use of snippet files that are markdown code blocks generates invalid markdown. The generated snippet code block should use a larger number of backticks than the content being embedded.
Please could there be a way for the user to request a larger-than-3 number of backticks to be used in the generated code blocks.
Context
This is an example snippet - it's a whole file, which is a markdown language block.
file name:
DocsSamplesForExplain.test.explain_boolean combinations.approved.query.text
file content:
Current behaviour
mdsnippets converts this line:
snippet: DocsSamplesForExplain.test.explain_boolean combinations.approved.query.text
to this:
This gives markdownlint warnings like:
Requested behaviour
Somehow enable mdsnippets to wrap the snippet with one more backtick than the text that is being inserted:
The requested difference is:
Describe the solution
Could the user have a way to specify the number of backticks to be used to delimit the inserted snippet code block please?
Ideas for the setting:
I think that it would be unreasonable to expect mdsnippets to parse every snippet to detect code blocks...
But allowing the user to select a project-wide larger number of backticks would allow inserting of markdown language blocks via mdsnippets.
Describe alternatives considered
For now my files to embed look like this, without the language. But this is a lot less useful for its users.
Additional context
None.
The text was updated successfully, but these errors were encountered: