Skip to content

Commit 66ee59d

Browse files
authored
Support handling body tag across multiple lines (#70)
Merge pull request 70
1 parent a9d6d27 commit 66ee59d

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

lib/jekyll-mentions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Mentions
88
GITHUB_DOT_COM = "https://github.com"
99
BODY_START_TAG = "<body"
1010

11-
OPENING_BODY_TAG_REGEX = %r!<body(.*?)>\s*!.freeze
11+
OPENING_BODY_TAG_REGEX = %r!<body(.*?)>\s*!m.freeze
1212

1313
InvalidJekyllMentionConfig = Class.new(Jekyll::Errors::FatalException)
1414

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE HTML>
2+
<html lang="en-US">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>{{ page.title }}</title>
6+
<meta name="viewport" content="width=device-width,initial-scale=1">
7+
<link rel="stylesheet" href="/css/screen.css">
8+
</head>
9+
<body
10+
class="wrap"
11+
>
12+
{{ content }}
13+
</body>
14+
</html>

spec/fixtures/multiline-body-tag.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
layout: multiline_body_tag
3+
title: Multi-line Body Tag
4+
---
5+
6+
test @TestUser test

spec/mentions_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ def para(content)
9191
)
9292
end
9393

94+
it "works with HTML body tag markup across multiple lines" do
95+
expect(find_by_title(site.pages, "Multi-line Body Tag").output).to include(para(result))
96+
end
97+
9498
context "when jekyll-mentions is set to false" do
9599
it "should not replace the @TestUser with the link to @TestUser" do
96100
expect(disabled_mentioning_page.output).not_to include(result)

0 commit comments

Comments
 (0)