Skip to content
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

implement transclusion #61

Merged
merged 3 commits into from
Mar 11, 2024
Merged

Conversation

therealbstern
Copy link
Contributor

This implements a WikiMedia feature they call "transclusion", which pulls one wiki page into another.

Right now, it uses [[filename.md]] to pull in another file.

Flaws:

  • No security: no defense against infinite loops. This could be added by limiting the depth of transclusion possible
  • No security: no defense against directory traversal when running with --fs.
  • No file-type checking: if a JPG contains [[...]] it will try to transclude and break the image

If any of these are too much for you to accept, please let me know and I can see if I can make the implementation more robust.

Copy link

netlify bot commented Feb 25, 2024

Deploy Preview for smeagol canceled.

Name Link
🔨 Latest commit 6c53e73
🔍 Latest deploy log https://app.netlify.com/sites/smeagol/deploys/65e6067a6ec6d000080fc5b2

@AustinWise
Copy link
Owner

Thanks for your contribution. I'm not too worried about that the flaws you mention, since this is a single user tool. I think we can address them if they become a problem.

I do request two small changes to syntax. First I think we should use {{filename.md}} as the syntax. It appears that a pretty common syntax for transclusion. If we use a common syntax, people's files are more portable between tools.

Examples:

I do see other syntaxes:

Secondly, for now I think the transclusion should only be allowed to appear on a line by itself.

src/wiki.rs Outdated Show resolved Hide resolved
@AustinWise
Copy link
Owner

Thanks again. I plan to do a release by this weekend at the latest.

@AustinWise AustinWise merged commit 8a99558 into AustinWise:master Mar 11, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants