-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
fix: don't replace block IDs in codeblocks #596
Conversation
Thank you for fixing this! It looks good, this project is in dire need of more unit tests, so thanks for taking the time to write them. As you mentioned, it would be nice if you could generate the new snapshot. You do this by running Let me know if something doesn't work, or you need any help. |
``` | ||
This codeblock has a transclusion syntax in it. | ||
Check it out: | ||
<div class="transclusion internal-embed is-loaded"><a class="markdown-embed-link" href="/001-links/" aria-label="Open link"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg></a><div class="markdown-embed"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting that this is actually evidence of a very similar bug: #599
@oleeskild Snapshot updated 📸 I left a comment on its output in this PR - there's a related issue (but this PR still fixes the issue it originally set out to 👍) |
Fixes #595 (which i reported)
The title of this PR is a little too narrow compared to what this PR actually does (
preserves code blocksactually not quite, see #599), but I wanted to match the issue that I'd opened.Took a quick stab at not replacing
^block-ids
within markdown codeblocks.Overview of the changes:
src/dg-testVault/015 Code blocks.md
createBlockIDs
into its own file/function (replaceBlockIDs
) so it could be tested independently of the compilerreplaceBlockIDs
fnThe actual mechanism for preserving block IDs within codeblocks is pretty simplistic:
text.replace
function collects the code blocks into an array and replaces them with unique placeholders.I probably didn't do something quite how you would have - let me know what the delta is and I'm happy to address it 🤠 For example: I suspect that a new snapshot is probably recommended, but I'd like some guidance on performing that new snapshot.
I'm very motivated to get this fixed as it is affecting my published notes (for example).