Table of content issue in R studio


#1

The most recent versions of R studio have a new issue:

Previously, to delimit code sections I would do the following:

#########################
### Section1: Do xyz ####
#########################

#########################
### Section2: Do abc ####
#########################

This would nicely appear in the table of contents in the following way:

Section1: Do xyz
Section2: Do abc

Unfortunately, in the newest Rstudio version, below is what happens:

Untitled
Section1: Do xyz
Untitled
Untitled
Section2: Do abc
Untitiled

The pound character is read as "untitled" which is really annoying, how can I address that issue?
Thanks


#2

I'm not sure your usage is valid markdown title/subtitles.

There are two types of title format in markdown, you can use one of them and the title will be picked up in TOC.

RStudio also support the folding comment format, so you can use

# some section header ----

and that section can be folded.

I guess you can use some other symbols if you want your original format, like

# *******************
# section 1
# ******************

#3

If you end a comment line with 4 # or - characters, that'll be interpreted as a "header." I like to make my header frames like this:

#-----------------------#
# Section1: Do xyz ------
#-----------------------#

#-----------------------#
# Section2: Do abc ------
#-----------------------#

The framing lines don't end in four of the same character, so they're seen as normal comments.


#4

Thanks that's helpful!