Repository: shyamd/mkdocs-bibtex

Issue:
bibtex makes the normal link in mkdocs not working.
I have made a simple example.

The repo directory tree is:

```
├── docs
│   ├── index.md
│   └── refs.bib
├── mkdocs.yml
```


The `mkdocs.yml` file is:
```yaml
site_name: My site
docs_dir: docs

theme:
  name: material

nav:
  - Home: index.md

plugins:
  - autorefs
  - search
  - bibtex:
      bib_file: 'docs/refs.bib'
```

The file content of `index.md` contains a normal link: `[displaying text](url)`.

```
This is [google](www.google.com).
```

If I use `mkdocs-bibtex==2.14.5`, the link. of `google` is rendered correctly.

<img width="521" alt="Image" src="https://github.com/user-attachments/assets/9e1d48c6-ad45-4e01-8bcc-8c469eea9694" />

But if I use `mkdocs-bibtex==3.0.0`, the link. of `google` is rendered incorrectly.

<img width="530" alt="Image" src="https://github.com/user-attachments/assets/5f63851e-7666-4488-ae52-8b436a28ec6d" />


Can you please help with this? Thanks!

Discussion:
@vinman1: Hello, I confirm experiencing the same issue when upgrading from version `2.21.0` to version `3.0.0`.

Also, The version `3.0.0` seems to also break certain code blocks, e.g. this **mermaid.js** code block no longer works when included with `mkdocs-material`:

```
```mermaid
flowchart LR
    one([Text1])
    two([Text2])
    three([Text3])

    one-->two-->three
```

```mermaid
flowchart LR
    one([Text1])
    two([Text2])
    three([Text3])

    one-->two-->three
```@j-machacek: Hello, just to support this bug report.
We are experiencing the same issues.@shyamd: I'm able to recreate the link example and will release a fix soon. I'm unable to recreate the mermaid JS example to fail. You run `mkdocs build` with `-v` and look at the debug output where it will show you the markdown before and after mkdocs-bibtex processes it. That is the best way to confirm this extension is making the change. @vinman1: thanks @shyamd ! I confirm that your fix in version 4.0.1 has fixed both the normal links and my mermaid JS issue. Much appreciated 🥳 

Solution patch:
diff --git a/src/mkdocs_bibtex/citation.py b/src/mkdocs_bibtex/citation.py
index de26016..84e5bef 100644
--- a/src/mkdocs_bibtex/citation.py
+++ b/src/mkdocs_bibtex/citation.py
@@ -67,9 +67,9 @@ class CitationBlock:
         citation_blocks = []
         for match in CITATION_BLOCK_REGEX.finditer(markdown):
             try:
-                citation_blocks.append(
-                    CitationBlock(raw=match.group(1), citations=Citation.from_markdown(match.group(1)))
-                )
+                citations = Citation.from_markdown(match.group(1))
+                if len(citations) > 0:
+                    citation_blocks.append(CitationBlock(raw=match.group(1), citations=citations))
             except Exception as e:
                 print(f"Error extracting citations from block: {e}")
         return citation_blocks


Test patch:
diff --git a/test_files/test_citation.py b/test_files/test_citation.py
index 9fc9f03..3c3dd07 100644
--- a/test_files/test_citation.py
+++ b/test_files/test_citation.py
@@ -135,3 +135,10 @@ def test_citation_string():
     citations = [citation, citation]
     block = CitationBlock(citations)
     assert str(block) == "[Author @test 2020; Author @test 2020]"
+
+
+def test_links_not_citations():
+    """Test that non-citations are not parsed as citations"""
+    markdown = "This is [google](www.google.com)."
+    blocks = CitationBlock.from_markdown(markdown)
+    assert len(blocks) == 0
diff --git a/test_files/test_integration.py b/test_files/test_integration.py
index e46cb60..17853ab 100644
--- a/test_files/test_integration.py
+++ b/test_files/test_integration.py
@@ -187,3 +187,12 @@ def test_full_bib_command_with_pandoc(pandoc_plugin):
     assert "[^test2]: Author F, Author S (2019b)" in result
     assert "[^Bivort2016]: De Bivort BL, Van Swinderen B (2016)" in result
     assert "[^test_citavi]: Author F, Author S (2019c)" in result
+
+
+def test_leaving_non_citations(plugin):
+    """Test that non-citations are not parsed as citations"""
+    markdown = "This is not a citation [google](www.google.com). But this is a citation [@test]."
+    result = plugin.on_page_markdown(markdown, None, None, None)
+
+    assert "[^test]" in result
+    assert "[google](www.google.com)" in result