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

[Filter] add filter to include local Markdown file via Markdown links in paragraphs #122

Merged
merged 1 commit into from
Aug 21, 2023

Conversation

cagix
Copy link
Owner

@cagix cagix commented Aug 21, 2023

include-mdfiles.lua – filter to include local Markdown files via links

for each link to local Markdown file in start document:
    (1) read file
    (2) "fix" links to local images, i.e. prepend include path
    (3) process links to local Markdown files in paragraphs and include content (recursively)
        - foreach Para:
            - prepare new empty block list (result), add new current block (empty Para)
            - foreach inline in current Para:
                - if not link: append inline to current block's content
                - if link:
                    - read link.target (file), process content and append resulting blocks to block list
                    - add new current block (empty Para) for remaining inlines of current block
            - return block list to replace current Para

warning: this won't handle endless recursion!

fixes #80

@cagix cagix self-assigned this Aug 21, 2023
@cagix cagix merged commit 34f854d into master Aug 21, 2023
@cagix cagix deleted the add_include_files branch August 21, 2023 10:18
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.

[Filter] Erlaube Einbindung anderer Markdown-Dateien über lokalen Link
1 participant