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

Switch to figures for block-level images #849

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/build/converters/markdown/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ module.exports = function (blog, text, options, callback) {
"-tex_math_dollars" +
// This sometimes throws errors for some reason
"-yaml_metadata_block" +
// Don't generate figures automatically
"-implicit_figures" +
// These require a blank line before shit
"+lists_without_preceding_blankline" +
"-blank_before_header" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<p><img src="/image?foo=bar&amp;baz=bat" alt="Image" /></p>
<figure>
<img src="/image?foo=bar&amp;baz=bat" alt="Image" />
<figcaption aria-hidden="true">Image</figcaption>
</figure>
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<p><img src="/path/to/_image.jpeg" width="250" alt="Caption" /></p>
<figure>
<img src="/path/to/_image.jpeg" width="250" alt="Caption" />
<figcaption aria-hidden="true">Caption</figcaption>
</figure>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
An image ![inline](_works.jpg) with the rest.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>An image <img src="_works.jpg" alt="inline" /> with the rest.</p>
2 changes: 1 addition & 1 deletion app/build/prepare/summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function summary($, title) {
// will be exluded
// ```
$(
"pre, .katex, script, object, iframe, style, h1, h2, h3, h4, h5, h6, img + .caption"
"pre, .katex, script, object, iframe, style, h1, h2, h3, h4, h5, h6, img + .caption, figcaption"
).remove();

// add a space before the end of
Expand Down
10 changes: 0 additions & 10 deletions app/build/tests/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ describe("build", function () {
};
});

it("will use a title to generate an image caption over the alt text", function (done) {
const contents = `![Alt text here](foo.jpg "Title here")`;
const path = "/hello.txt";
const html =
'<p><img src="/foo.jpg" title="Title here" alt="Alt text here"><span class="caption">Title here</span></p>';

this.blog.plugins.imageCaption = { enabled: true, options: {} };
this.buildAndCheck({ path, contents }, { html }, done);
});

it("will turn titles into title case if plugin is enabled", function (done) {
const contents = "# Title goes here";
const path = "/hello.txt";
Expand Down