You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My application is inserting snippets from compilable Go code into a README.md. I wasn't able to use embedmd for a couple of reasons.
I want to exclude the matching regexps, so I can write comments in the Go code that delimit the snippet. I don't want to match the snippet code itself, because that is fragile—it can change. See support a flag to exclude matching lines #46.
I really want to exclude the line the regexp is on. Not a big deal, just add .* to the regexp, but I need to do that for every one, so it's a little error-prone.
The snippets are typically inside functions, so they have a leading tab. I need to remove this tab from each line so that my Markdown code blocks are not indented. No way to do this in the current embedmd model.
Another whitespace issue: at top-level, gofmt puts a blank line between code and a following comment. If that comment is an end-of-snippet delimiter, I need to drop that final blank line, or it will end up in my markdown. (I want to preserve blank lines inside the snippet, however.)
Sometimes one wants to write ... in a snippet as a placeholder. E.g.
tokenSource:=...client=New(ctx, tokenSource)
Since that isn't legal Go, I need something that will transform legal Go into it. E.g. replace ELLIPSIS and _ = ELLIPSIS with ....
The text was updated successfully, but these errors were encountered:
My application is inserting snippets from compilable Go code into a README.md. I wasn't able to use embedmd for a couple of reasons.
I want to exclude the matching regexps, so I can write comments in the Go code that delimit the snippet. I don't want to match the snippet code itself, because that is fragile—it can change. See support a flag to exclude matching lines #46.
I really want to exclude the line the regexp is on. Not a big deal, just add
.*
to the regexp, but I need to do that for every one, so it's a little error-prone.The snippets are typically inside functions, so they have a leading tab. I need to remove this tab from each line so that my Markdown code blocks are not indented. No way to do this in the current embedmd model.
Another whitespace issue: at top-level, gofmt puts a blank line between code and a following comment. If that comment is an end-of-snippet delimiter, I need to drop that final blank line, or it will end up in my markdown. (I want to preserve blank lines inside the snippet, however.)
Sometimes one wants to write
...
in a snippet as a placeholder. E.g.Since that isn't legal Go, I need something that will transform legal Go into it. E.g. replace
ELLIPSIS
and_ = ELLIPSIS
with...
.The text was updated successfully, but these errors were encountered: