Skip to content

Commit

Permalink
fix the test from #938 (the anchor should point to section 2 instead …
Browse files Browse the repository at this point in the history
…of 2.1)
  • Loading branch information
yihui committed Sep 13, 2020
1 parent 06c32c0 commit de7c238
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test-rmd.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if (Sys.getenv('NOT_CRAN') == 'true') local({

# number sections now works in markdown_document2
if (!any(readLines("rmd/number-sections.md") == "1.1 subsection 1") ||
!any(grepl("<a href=.*>2.1</a>", readLines("rmd/number-sections.md")))) {
!any(grepl("<a href=.*>2</a>", readLines("rmd/number-sections.md")))) {
stop("Something wrong in number_sections.Rmd")
}
})

2 comments on commit de7c238

@cderv
Copy link
Collaborator

@cderv cderv commented on de7c238 Sep 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was a bad idea to have mixed reference... 😅

The resulting html file rendered is this one
1 Section 1
===========

Some content

1.1 subsection 1
----------------

Hello.

See chapter 2 now at <a href="#section-2">2</a>

2 Section 2
===========

2.1 subsection 2
----------------

    plot(iris)

<img src="number-sections_files/figure-markdown_strict/iris-plot-1.png" alt="A plot"  />
<p class="caption">
Figure 2.1: A plot
</p>

See figure <a href="#fig:iris-plot">2.1</a>

And I wanted to test the figure reference

See figure <a href="#fig:iris-plot">2.1</a>

that previously was only counting the figure globally (so it was 1 instead of 2.1 now)

The section reference already works as expected before the introduction of numbered section work this type of output. (even if the section wasn't numbered )

So the test seems good to me... 🤔 I just should have deleted the line referencing the section header to keep only the figure reference maybe.

@yihui
Copy link
Member Author

@yihui yihui commented on de7c238 Sep 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, you are correct. I'll get rid of this commit.

Please sign in to comment.