Closed skalee closed 6 years ago
I think these are meant to be actual comments.
Are there any better alternatives for commenting?
Looks like this is an attempt to insert HTML comment: https://stackoverflow.com/a/20885980/304175
I've tried all reasonable ways of comment insertion in Markdown I could find in StackOverflow:
[comment]: <> (This is a comment, it will not be included)
[//]: <> (This is also a comment.)
[//]: # (This may be the most platform independent comment)
<!-- HTML comment -->
Neither passed our blueprints validator. Also, according to https://github.com/apiaryio/api-blueprint/issues/139, they aren't supported purposely for aesthetic reasons, despite numerous community requests.
I see three options:
input.apib
, and IMHO we can live without them.I think we should go either with 1) – no comments = no problems, or 3) which is pretty simple to implement, it's just a simple regular expression to be passed to sed/awk/grep.
Just found a nice NPM package: https://www.npmjs.com/package/erase. It erases marked parts from document. However, there will be blank lines leftovers, so perhaps sed is better.
This might be also doable with Hercule's resolvers, if we define a custom "comment" resolver which always returns some empty content. I'm pretty sure it's the best option for now, and I'll do some experimenting.
Follow-up after experimenting – we got 3 options:
First two are described in earlier comments. The third one is easy to do, however has two flaws.
Firstly, it must fit transclusion syntax (:[]()
). It will look like quite weird, especially that whatever is between parentheses, must be an URI.
:[This is a comment](comment)
:[This is a comment](//)
:[](comment:This-is-also-a-comment-but-whitespaces-ale-disallowed-here)
Secondly, there is no way to remove leading and trailing blank lines, hence resulting apiary.apib may contain several subsequent newlines which are meaningful in Markdown. On the other hand, we got few already and this doesn't seem to be a problem.
So, what we do? And if resolver, which syntax? Personally I'm slightly against resolvers because of syntax requirements which make things look weird.
Agreed. 1. and 2. seem to be the best options for now.
2 seems the most flexible, and it's easy to modify.
Validator says: