Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ project:
changes from new major versions. This approach is critical for ensuring build
stability and reproducibility.
- **Prohibit unstable version specifiers.** The use of wildcard (`*`) or
open-ended inequality (`>=`) version requirements is strictly forbidden, as it
introduces unacceptable risk and unpredictability. Tilde requirements (`~`)
should only be used where a dependency must be locked to patch-level updates
for a specific, documented reason.
open-ended inequality (`>=`) version requirements is strictly forbidden, as
it introduces unacceptable risk and unpredictability. Tilde requirements
(`~`) should only be used where a dependency must be locked to patch-level
updates for a specific, documented reason.

### Error Handling

Expand Down
12 changes: 7 additions & 5 deletions src/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@
} else {
false
}
}

Check warning on line 84 in src/html.rs

View workflow job for this annotation

GitHub Actions / build-test

Diff in /home/runner/work/mdtablefix/mdtablefix/src/html.rs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (review_instructions): The module is missing a //! module-level comment at the top.

Please add a //! comment at the very top of the file to describe the module's purpose, as required by the review instructions.

Review instructions:

Path patterns: **/*.rs

Instructions:
Every module must begin with a //! comment.

/// Returns `true` if `handle` represents a `<td>` or `<th>` element.
fn is_table_cell(handle: &Handle) -> bool { is_element(handle, "td") || is_element(handle, "th") }
fn is_table_cell(handle: &Handle) -> bool {
is_element(handle, "td") || is_element(handle, "th")
}

/// Walks the DOM tree collecting `<table>` nodes under `handle`.
fn collect_tables(handle: &Handle, tables: &mut Vec<Handle>) {
Expand Down Expand Up @@ -112,10 +114,10 @@

/// Returns `true` if `handle` contains a `<b>` or `<strong>` descendant.
fn contains_strong(handle: &Handle) -> bool {
if let NodeData::Element { name, .. } = &handle.data
&& is_bold_tag(name.local.as_ref())
{
return true;
if let NodeData::Element { name, .. } = &handle.data {
if is_bold_tag(name.local.as_ref()) {
return true;
}
}
let children = handle.children.borrow();
children.iter().any(contains_strong)
Expand Down
4 changes: 3 additions & 1 deletion src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
}

/// Rewrite a file in place with wrapped tables.
///

Check warning on line 30 in src/io.rs

View workflow job for this annotation

GitHub Actions / build-test

Diff in /home/runner/work/mdtablefix/mdtablefix/src/io.rs
/// # Errors
/// Returns an error if reading or writing the file fails.
pub fn rewrite(path: &Path) -> std::io::Result<()> { rewrite_with(path, process_stream) }
pub fn rewrite(path: &Path) -> std::io::Result<()> {
rewrite_with(path, process_stream)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (review_instructions): The module is missing a //! module-level comment at the top.

Please add a //! comment at the very top of the file to describe the module's purpose, as required by the review instructions.

Review instructions:

Path patterns: **/*.rs

Instructions:
Every module must begin with a //! comment.

/// Rewrite a file in place without wrapping text.
///
Expand Down
19 changes: 14 additions & 5 deletions src/wrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
/// Re-export this so callers of [`crate::textproc`] can implement custom
/// transformations without depending on internal modules.
pub use tokenize::Token;
/// Tokenize a block of Markdown while preserving fence context.
/// Convenience re-export of [`tokenize::tokenize_markdown`].
#[doc(inline)]
pub use tokenize::tokenize_markdown;

static FENCE_RE: std::sync::LazyLock<Regex> =
Expand Down Expand Up @@ -49,14 +50,20 @@
is_bq: bool,
build_prefix: fn(&Captures) -> String,
rest_group: usize,
}

Check warning on line 53 in src/wrap.rs

View workflow job for this annotation

GitHub Actions / build-test

Diff in /home/runner/work/mdtablefix/mdtablefix/src/wrap.rs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (review_instructions): The module is missing a //! module-level comment at the top.

Please add a //! comment at the very top of the file to describe the module's purpose, as required by the review instructions.

Review instructions:

Path patterns: **/*.rs

Instructions:
Every module must begin with a //! comment.

impl PrefixHandler {
fn build_bullet_prefix(cap: &Captures) -> String { cap[1].to_string() }
fn build_bullet_prefix(cap: &Captures) -> String {
cap[1].to_string()
}

fn build_footnote_prefix(cap: &Captures) -> String { format!("{}{}", &cap[1], &cap[2]) }
fn build_footnote_prefix(cap: &Captures) -> String {
format!("{}{}", &cap[1], &cap[2])
}

fn build_blockquote_prefix(cap: &Captures) -> String { cap[1].to_string() }
fn build_blockquote_prefix(cap: &Captures) -> String {
cap[1].to_string()
}
}

static HANDLERS: &[PrefixHandler] = &[
Expand Down Expand Up @@ -186,10 +193,12 @@
lines.push(trimmed.to_string());
}
lines
}

Check warning on line 196 in src/wrap.rs

View workflow job for this annotation

GitHub Actions / build-test

Diff in /home/runner/work/mdtablefix/mdtablefix/src/wrap.rs

#[doc(hidden)]
pub fn is_fence(line: &str) -> bool { FENCE_RE.is_match(line) }
pub fn is_fence(line: &str) -> bool {
FENCE_RE.is_match(line)
}

pub(crate) fn is_markdownlint_directive(line: &str) -> bool {
MARKDOWNLINT_DIRECTIVE_RE.is_match(line)
Expand Down
2 changes: 1 addition & 1 deletion tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
}

/// Expands to a `Vec<String>` with one element per line of the file.
///

Check warning on line 19 in tests/common/mod.rs

View workflow job for this annotation

GitHub Actions / build-test

Diff in /home/runner/work/mdtablefix/mdtablefix/tests/prelude/../common/mod.rs

Check warning on line 19 in tests/common/mod.rs

View workflow job for this annotation

GitHub Actions / build-test

Diff in /home/runner/work/mdtablefix/mdtablefix/tests/prelude/../common/mod.rs

Check warning on line 19 in tests/common/mod.rs

View workflow job for this annotation

GitHub Actions / build-test

Diff in /home/runner/work/mdtablefix/mdtablefix/tests/prelude/../common/mod.rs

Check warning on line 19 in tests/common/mod.rs

View workflow job for this annotation

GitHub Actions / build-test

Diff in /home/runner/work/mdtablefix/mdtablefix/tests/prelude/../common/mod.rs

Check warning on line 19 in tests/common/mod.rs

View workflow job for this annotation

GitHub Actions / build-test

Diff in /home/runner/work/mdtablefix/mdtablefix/tests/prelude/../common/mod.rs

Check warning on line 19 in tests/common/mod.rs

View workflow job for this annotation

GitHub Actions / build-test

Diff in /home/runner/work/mdtablefix/mdtablefix/tests/prelude/../common/mod.rs
/// Example:
/// ```
/// let input: Vec<String> = include_lines!("data/bold_header_input.txt");
/// let input: Vec<String> = include_lines!("data/bold_header_input.txt");
/// ```
#[expect(unused_macros, reason = "macros are optional helpers across modules")]
macro_rules! include_lines {
Expand Down
Loading