Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[Change Request] Allow plugins to edit metadata before on_page_markdown #3555

Closed
McDic opened this issue Jan 21, 2024 · 0 comments · May be fixed by #3556
Closed

[Change Request] Allow plugins to edit metadata before on_page_markdown #3555

McDic opened this issue Jan 21, 2024 · 0 comments · May be fixed by #3556

Comments

@McDic
Copy link

McDic commented Jan 21, 2024

Hello.

I was building a plugin which tracks git history of a file on non-metadata lines. I wanted to track only content edit history, not metadata edit history. But I realized self.meta is overrided by meta.get_date in following lines;

def read_source(self, config: MkDocsConfig) -> None:
source = config.plugins.on_page_read_source(page=self, config=config)
if source is None:
try:
with open(self.file.abs_src_path, encoding='utf-8-sig', errors='strict') as f:
source = f.read()
except OSError:
log.error(f'File not found: {self.file.src_path}')
raise
except ValueError:
log.error(f'Encoding error reading file: {self.file.src_path}')
raise
self.markdown, self.meta = meta.get_data(source)

Therefore I request mkdocs to change this behavior. I can upload pull requests myself if you want.

@mkdocs mkdocs locked and limited conversation to collaborators Apr 15, 2024
@tomchristie tomchristie converted this issue into discussion #3639 Apr 15, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant