Skip to content

Commit 1aa2bc3

Browse files
authored
Merge branch 'main' into dependabot/github_actions/pre-commit-ci/lite-action-1.0.3
2 parents 378f044 + 5383542 commit 1aa2bc3

6 files changed

Lines changed: 30 additions & 32 deletions

File tree

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Harden Runner
18-
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
18+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
1919
with:
2020
egress-policy: audit
2121
- name: 'Checkout Repository'

.github/workflows/general.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Harden Runner
21-
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
21+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
2222
with:
2323
egress-policy: audit
2424
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -30,7 +30,7 @@ jobs:
3030
runs-on: ubuntu-latest
3131
steps:
3232
- name: Harden Runner
33-
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
33+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
3434
with:
3535
egress-policy: audit
3636
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -43,7 +43,7 @@ jobs:
4343
runs-on: ubuntu-latest
4444
steps:
4545
- name: Harden Runner
46-
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
46+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
4747
with:
4848
egress-policy: audit
4949
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -53,7 +53,7 @@ jobs:
5353
runs-on: ubuntu-latest
5454
steps:
5555
- name: Harden Runner
56-
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
56+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
5757
with:
5858
egress-policy: audit
5959
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -67,7 +67,7 @@ jobs:
6767
runs-on: ubuntu-latest
6868
steps:
6969
- name: Harden Runner
70-
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
70+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
7171
with:
7272
egress-policy: audit
7373
- name: Install Linux Dependencies

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Harden Runner
14-
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
14+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
1515
with:
1616
egress-policy: audit
1717
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
# actions: read
3030
steps:
3131
- name: Harden Runner
32-
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
32+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
3333
with:
3434
egress-policy: audit
3535
- name: "Checkout code"

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ fn strip_trailing_sentence_stub(text: &str) -> (&str, usize) {
9292
}
9393

9494
if let Some(value) =
95-
text[..].rfind(|val: char| val == '.' || val == '\n' || val == '!' || val == '?')
95+
//text[..].rfind(|val: char| val == '.' || val == '\n' || val == '!' || val == '?')
96+
text[..].rfind(['.', '\n', '!', '?'])
9697
{
9798
// last character as a &str
9899
let last = &text[value..=value];

src/markdown/mod.rs

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -114,32 +114,29 @@ pub fn parse_markdown_to_html(
114114
let mut parsing_heading = false;
115115
let mut word_count: u32 = 0;
116116

117-
let heading_parser = Parser::new_ext(markdown, options).map(|event| {
118-
match &event {
119-
Event::Start(Tag::Heading { .. }) => {
120-
parsing_heading = true;
121-
}
122-
Event::Text(value) => {
123-
word_count += words(value);
124-
if parsing_heading {
125-
current_id_fragments.push_str(value);
126-
}
127-
}
128-
Event::Code(value) => {
129-
if parsing_heading {
130-
current_id_fragments.push_str(value);
131-
}
117+
let heading_parser = Parser::new_ext(markdown, options).inspect(|event| match event {
118+
Event::Start(Tag::Heading { .. }) => {
119+
parsing_heading = true;
120+
}
121+
Event::Text(value) => {
122+
word_count += words(value);
123+
if parsing_heading {
124+
current_id_fragments.push_str(value);
132125
}
133-
Event::End(TagEnd::Heading(_heading_level)) => {
134-
let heading = &current_id_fragments;
135-
let id = slugified_title(&current_id_fragments);
136-
headings.push(Heading::new(heading, &id));
137-
current_id_fragments = String::new();
138-
parsing_heading = false;
126+
}
127+
Event::Code(value) => {
128+
if parsing_heading {
129+
current_id_fragments.push_str(value);
139130
}
140-
_ => {}
141131
}
142-
event
132+
Event::End(TagEnd::Heading(_heading_level)) => {
133+
let heading = &current_id_fragments;
134+
let id = slugified_title(&current_id_fragments);
135+
headings.push(Heading::new(heading, &id));
136+
current_id_fragments = String::new();
137+
parsing_heading = false;
138+
}
139+
_ => {}
143140
});
144141
html::write_html(Cursor::new(&mut bytes), heading_parser)?;
145142
let reading_time = reading_time_from_words(word_count);

0 commit comments

Comments
 (0)