Merge pull request #2458 from the-mikedavis/md-cancellation-highlight
feat(cli): Re-use highlight cancellation flag for HTML highlights
This commit is contained in:
commit
0c5a6eb525
2 changed files with 3 additions and 3 deletions
|
|
@ -1,4 +1,3 @@
|
|||
use super::util;
|
||||
use ansi_term::Color;
|
||||
use anyhow::Result;
|
||||
use lazy_static::lazy_static;
|
||||
|
|
@ -385,16 +384,16 @@ pub fn html(
|
|||
config: &HighlightConfiguration,
|
||||
quiet: bool,
|
||||
print_time: bool,
|
||||
cancellation_flag: Option<&AtomicUsize>,
|
||||
) -> Result<()> {
|
||||
use std::io::Write;
|
||||
|
||||
let stdout = io::stdout();
|
||||
let mut stdout = stdout.lock();
|
||||
let time = Instant::now();
|
||||
let cancellation_flag = util::cancel_on_signal();
|
||||
let mut highlighter = Highlighter::new();
|
||||
|
||||
let events = highlighter.highlight(config, source, Some(&cancellation_flag), |string| {
|
||||
let events = highlighter.highlight(config, source, cancellation_flag, |string| {
|
||||
loader.highlight_config_for_injection_string(string)
|
||||
})?;
|
||||
|
||||
|
|
|
|||
|
|
@ -609,6 +609,7 @@ fn run() -> Result<()> {
|
|||
highlight_config,
|
||||
quiet,
|
||||
time,
|
||||
Some(&cancellation_flag),
|
||||
)?;
|
||||
} else {
|
||||
highlight::ansi(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue