Browse Source

Change continue-reading to use a span with id instead of a named anchor in a paragraph (#941)

* Change continue-reading to use a span element instead of named anchor

* Fix all tests
index-subcmd
Aphek GitHub 4 years ago
parent
commit
cc67bf0c88
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 7 deletions
  1. +1
    -2
      components/rendering/src/markdown.rs
  2. +1
    -1
      components/rendering/tests/markdown.rs
  3. +2
    -2
      components/site/tests/site.rs
  4. +1
    -2
      docs/content/documentation/content/page.md

+ 1
- 2
components/rendering/src/markdown.rs View File

@@ -17,8 +17,7 @@ use utils::vec::InsertMany;


use self::cmark::{Event, LinkType, Options, Parser, Tag}; use self::cmark::{Event, LinkType, Options, Parser, Tag};


const CONTINUE_READING: &str =
"<p id=\"zola-continue-reading\"><a name=\"continue-reading\"></a></p>\n";
const CONTINUE_READING: &str = "<span id=\"continue-reading\"></span>";
const ANCHOR_LINK_TEMPLATE: &str = "anchor-link.html"; const ANCHOR_LINK_TEMPLATE: &str = "anchor-link.html";


#[derive(Debug)] #[derive(Debug)]


+ 1
- 1
components/rendering/tests/markdown.rs View File

@@ -757,7 +757,7 @@ Bla bla
.unwrap(); .unwrap();
assert_eq!( assert_eq!(
res.body, res.body,
"<p>Hello <a href=\"https://vincentprouillet.com\">My site</a></p>\n<p id=\"zola-continue-reading\"><a name=\"continue-reading\"></a></p>\n<p>Bla bla</p>\n"
"<p>Hello <a href=\"https://vincentprouillet.com\">My site</a></p>\n<span id=\"continue-reading\"></span>\n<p>Bla bla</p>\n"
); );
assert_eq!( assert_eq!(
res.summary_len, res.summary_len,


+ 2
- 2
components/site/tests/site.rs View File

@@ -239,11 +239,11 @@ fn can_build_site_with_live_reload_and_drafts() {
// no live reload code // no live reload code
assert!(file_contains!(public, "index.html", "/livereload.js")); assert!(file_contains!(public, "index.html", "/livereload.js"));


// the summary anchor link has been created
// the summary target has been created
assert!(file_contains!( assert!(file_contains!(
public, public,
"posts/python/index.html", "posts/python/index.html",
r#"<a name="continue-reading"></a>"#
r#"<span id="continue-reading"></span>"#
)); ));


// Drafts are included // Drafts are included


+ 1
- 2
docs/content/documentation/content/page.md View File

@@ -141,6 +141,5 @@ where you want the summary to end. The content up to that point will be
available separately in the available separately in the
[template](@/documentation/templates/pages-sections.md#page-variables). [template](@/documentation/templates/pages-sections.md#page-variables).


An anchor link to this position named `continue-reading` is created, wrapped in a paragraph
with a `zola-continue-reading` id, so you can link directly to it if needed. For example:
A span element in this position with a `continue-reading` id is created, so you can link directly to it if needed. For example:
`<a href="{{ page.permalink }}#continue-reading">Continue Reading</a>`. `<a href="{{ page.permalink }}#continue-reading">Continue Reading</a>`.

Loading…
Cancel
Save