ReMe/reme/schema/file_link.py
jinliyl a9ec334adc
feat: simplify wikilink semantics and support line anchors (#412)
* feat: simplify local links and support line anchors

* fix: align line anchor tests with CI lint

* fix: preserve local links across file moves

* fix: encode markdown paths when rewriting links

* refactor(read): keep explicit line range parameters

* fix: simplify legacy link predicate compatibility

* docs: align local link behavior with implementation

* fix: skip unsupported markdown destination escapes

* fix: normalize workspace link paths across platforms

* fix: bound markdown link scanning

* fix: keep local link processing linear

* docs: clarify permissive markdown link parsing

* fix: handle local link processing failures

* refactor: limit file links to wikilink syntax

* docs: align wikilink contract with implementation

* fix: normalize dream and neighbor paths on Windows

* fix: resolve workspace path for neighbor expansion
2026-08-05 11:47:50 +08:00

20 lines
730 B
Python

"""FileLink"""
from pydantic import BaseModel, ConfigDict, Field
class FileLink(BaseModel):
"""file link
[[target_path]]
[[target_path#target_anchor]]
"""
model_config = ConfigDict(extra="forbid")
source_path: str = Field(default=..., description="source file path relative to working dir")
target_path: str = Field(default=..., description="target file path relative to working dir")
target_anchor: str | None = Field(default=None, description="Heading, block, or line anchor (text after '#')")
predicate: str | None = Field(
default=None,
exclude=True,
description="Deprecated compatibility field; accepted when loading legacy indexes but otherwise unused",
)