Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrocp committed Oct 5, 2023
1 parent 81813c2 commit 3ff0f2d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: Precomp NIFs

env:
NIF_DIRECTORY: "native/comrak_nif"

on:
push:
branches:
Expand Down Expand Up @@ -71,7 +68,7 @@ jobs:
- name: Build the project
id: build-crate
uses: philss/rustler-precompiled-action@v1.0.1
uses: philss/rustler-precompiled-action@v1.1.0
with:
project-name: comrak_nif
project-version: ${{ env.PROJECT_VERSION }}
Expand Down
2 changes: 2 additions & 0 deletions native/comrak_nif/src/inkjet_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ impl<'a> SyntaxHighlighterAdapter for InkjetAdapter<'a> {
None => None,
},
)
// TODO: fallback to plain text
.expect("expected to generate the syntax highlight events");

for event in highlights {
// TODO: fallback to plain text
let event = event.expect("expected a highlight event");
let inner_highlights = autumn::inner_highlights(source, event, self.theme);
write!(output, "{}", inner_highlights)?
Expand Down
5 changes: 4 additions & 1 deletion native/comrak_nif/vendor/autumn/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn highlight_source_code(
None => None,
},
)
// TODO: fallback to plain text
.expect("expected to generate the syntax highlight events");

output.push_str(
Expand All @@ -37,6 +38,7 @@ pub fn highlight_source_code(
);

for event in highlights {
// TODO: fallback to plain text
let event = event.expect("expected a highlight event");
let highlight = inner_highlights(source, event, theme);
output.push_str(highlight.as_str())
Expand Down Expand Up @@ -97,7 +99,8 @@ pub fn inner_highlights(source: &str, event: HighlightEvent, theme: &Theme) -> S
HighlightEvent::Source { start, end } => {
let span = source
.get(start..end)
.expect("Source bounds should be in bounds!");
// TODO: fallback to plain text
.expect("source bounds should be in bounds!");
let span = v_htmlescape::escape(span).to_string();
output.push_str(span.as_str())
}
Expand Down

0 comments on commit 3ff0f2d

Please sign in to comment.