-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from UofGAnalytics/figure-anchor-links
add automatic anchor links to figures
- Loading branch information
Showing
3 changed files
with
94 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { | ||
ignoreWhitespace, | ||
testProcessor, | ||
} from '../../test-utils/test-processor'; | ||
|
||
// <figure class="img-wrapper" id="#my-alt-text"> | ||
// <img src="/var/folders/dy/tzrrqxmx7_701rcnq9dnvfvh0000gp/T" alt="My alt text"> | ||
// <figcaption> | ||
// <a href="#my-alt-text"> | ||
// <span class="caption-count">Figure 1: </span> | ||
// My alt text | ||
// </a> | ||
// </figcaption> | ||
// </figure> | ||
|
||
describe('images', () => { | ||
it('should render an html figure', async () => { | ||
const { html } = await testProcessor(` | ||
![]() | ||
`); | ||
|
||
expect(ignoreWhitespace(html)).toMatch( | ||
/<figureclass="img-wrapper"id="figure-1"><imgsrc=".+"alt=""><figcaption><ahref="#figure-1"><spanclass="caption-count">Figure1<\/span><\/a><\/figcaption><\/figure>/ | ||
); | ||
}); | ||
|
||
it('should render an html figure with alt text', async () => { | ||
const { html } = await testProcessor(` | ||
![My alt text]() | ||
`); | ||
|
||
expect(ignoreWhitespace(html)).toMatch( | ||
/<figureclass="img-wrapper"id="my-alt-text"><imgsrc=".+"alt="Myalttext"><figcaption><ahref="#my-alt-text"><spanclass="caption-count">Figure1:<\/span>Myalttext<\/a><\/figcaption><\/figure>/ | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters