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

Add ExactAttachment header #22

Merged
merged 2 commits into from
Jul 19, 2020

Conversation

csoutherland
Copy link
Contributor

Added an ExactAttachment header that doesn't require the use of an attachment:// URL scheme. This should simplify using mark as a tool for something like keeping GitHub and Confluence in sync at the cost of adding a tool that may give undesired behavior in some circumstances if used without caution.

Unfortunately, I had to change the pkg/mark/Meta data structure to get an approach that was relatively easy on the eyes. However, I figured it might be a good place to make the change in case a syntactic change is preferable over ExactAttachment and/or regular expression replacement becomes a priority.

I tried both attachment mechanisms with my local build and everything seems to be working with the refactor and the new header. In fact, I now have a GitHub and Confluence page that look more or less identical (including locally generated images) from the same markdown code, which was at least my own goal.

@kovetskiy
Copy link
Owner

Thanks for the PR!

I've been thinking about this feature for a few days, what if we actually drop current Attachment implementation and use the ExactAttachment implementation instead of it?

But in order to save backward compatibility we will have to look for attachment:// links first.

Like as the following:

  1. Parsed <-- Attachment: x.png -->
  2. Find attachment://x.png in markdown, if found, then replace and go to step 4, if not go to step 3
  3. Find x.png in markdown, replace if found
  4. Done

What do you think?

@kovetskiy kovetskiy changed the base branch from master to rework-attachments July 19, 2020 14:35
@kovetskiy kovetskiy merged commit f39aeb1 into kovetskiy:rework-attachments Jul 19, 2020
@csoutherland
Copy link
Contributor Author

Oh, sorry, got pulled into some other things and never noticed the update on this PR. I really like the approach you ended up with!

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