Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Removing tab indentation from before documentation comments. #34

Closed
wants to merge 1 commit into from

3 participants

@webspinner

One of the things that has gotten under my wheels using this great doc generator is that: if I am working in a browser code base I am usually nested inside of a closure, maybe in an object definition or other indented code segment when I want to document something. The documentation comments in this area should be aligned with the code so they are indented as well. The original way of handling this was for dox to treat these segments as code blocks. This patch removes the leading tabs on a comment so that markdown will render them properly. I hope you receive this change well and I thank you for making this tool available. It works head and shoulders above the other solutions I have tried.

Regards,
Gabriel

@ignacioiglesias

I was trying Dox for the first time and this was the only thing that kept me from using it. Thanks!

@ForbesLindesay

Since indented comments now work, should this be closed? Although there is a small bug with indented comments in that the code property doesn't maintain the correct indentation, instead it looses the preceding indentation on the first line, but keeps it on the rest.

@webspinner

Good call @ForbesLindesay I haven't even gone back to using dox because of these types of bugs. I will close this but the issues need to be addressed.

@webspinner webspinner closed this
@ForbesLindesay

I've submitted a pull request that fixes that bug now, just hope @visionmedia accepts it

@ForbesLindesay

@webspinner Any chance you came across something else good when you stopped using this? I really need a good system for automatically parsing comments to json for a project I'm working on.

@webspinner

@ForbesLindesay sadly no, we just ended up doing our docs and not generating automatically, which cost us a bit but also had a couple benefits as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 5, 2011
  1. @webspinner
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/dox/index.js
View
4 lib/dox/index.js
@@ -241,7 +241,9 @@ exports.parse = function(args){
*/
var render = exports.render = function(str, file){
- var parts = str.split(/\s*\/\*([^]+?)\*\/\s*/g),
+ // this line should replace leading spaces and indentation on comments that are intended to be documentation.
+ str = str.replace(/^[\t]*(\s?\/?\*{1,2})/mg, '$1');
+ var parts = str.split(/\s*\/\*([^]+?)\*\/\s*/g),
blocks = [];
// Populate blocks
Something went wrong with that request. Please try again.