Skip to content
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

enable <!-- --> comments for Markdown #482

Merged
merged 4 commits into from Aug 28, 2015
Merged

Conversation

kevinushey
Copy link
Contributor

(NOTE: not quite ready for merge)

This PR:

  1. Rewrites the doCommentUncomment() method to be line-by-line, rather than targeted on a whole selection (using regexes). This makes it easier to control how commenting works for 'double-sided' comments and also makes it a bit easier to handle what happens when considering commenting a line containing only whitespace.

  2. Using the above, enables <!-- --> comments for Markdown modes.

As is tradition, a GIF showing this in action in an R Markdown document. Note that lines containing only whitespace within a selection are commented when within R mode, but not when within Markdown mode. (This seems like the most natural behaviour to me)

comment

@kevinushey
Copy link
Contributor Author

One main difference between the new and old scheme is that the new scheme respects indentation within blocks, e.g.

    foo <- function(x) {
        print(1)
    }

is indented as

    # foo <- function(x) {
    #    print(1)
    # }

instead of

#     foo <- function(x) {
#         print(1)
#     }

I believe this is an improvement (and this is also the behaviour when we comment a single line); thoughts?

@jjallaire
Copy link
Member

This looks great! (I've often been frustrated by the fact that comment/uncomment doesn't work in markdown). Also agree 100% with the new indenting behavior. Let me know once you think this is ready for merge and I'll take it.

@kevinushey
Copy link
Contributor Author

Should be good to go now!

jjallaire added a commit that referenced this pull request Aug 28, 2015
enable <!-- --> comments for Markdown
@jjallaire jjallaire merged commit 15f5537 into master Aug 28, 2015
@jjallaire
Copy link
Member

Could you add a NEWS.md item for this?

@kevinushey
Copy link
Contributor Author

Done!

@valerie-rstudio valerie-rstudio deleted the feature/markdown-comments branch January 21, 2022 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants