Skip to content

WIP: Correct readme index preprocessing #1316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

duchainer
Copy link

@duchainer duchainer commented Sep 8, 2020

Closes #1268

Uses commented regexes for matching inline and reference-style links.

https://github.com/badboy/mdbook-toc

https://docs.rs/pulldown-cmark/0.7.2/pulldown_cmark/

https://docs.rs/pulldown-cmark/0.7.2/pulldown_cmark/enum.LinkType.html
pulldown_cmark::LinkType - Rust
API documentation for the Rust LinkType enum in crate pulldown_cmark.

use pulldown_cmark::{Event, LinkType, Options, Parser};
fn main() {
    let md_input = r#"
# My title
[title]: #my-title

Hi im referencing [title] as well as a [reference][1] and [inline](./heelo.md)

[1]: ./Hai.md

    "#;

    let opts = Options::all();

    let parse = Parser::new_ext(md_input, opts);

    for elem in parse {
        println!("{:?}", elem);
    }
}```

The summary uses the right path for those files, but not the mardown
files link like [bla](./bla/README.md).
The cause of the problem was that IndexPreprocessor renamed README.md
files to index.md without replacing in the links.

TODO: use a case-insensitive replace instead.
Still need to get the ranges right though
@duchainer
Copy link
Author

Waiting for the merge of link definition to complete this PR : pulldown-cmark/pulldown-cmark#423. Until then, this code is open to any edits as I'll comment before returning to this issue. Code away. ^^

@rustbot
Copy link
Collaborator

rustbot commented Apr 30, 2025

☔ The latest upstream changes (possibly #2681) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot rustbot added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subpages links doesn't work
2 participants