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 a converter that finds gist URLs and converts these to gist shortcodes for Hugo #39

Merged
merged 7 commits into from
Sep 4, 2024

Conversation

lawrencegripper
Copy link
Contributor

@lawrencegripper lawrencegripper commented Sep 4, 2024

No description provided.

Copy link
Owner

@ashishb ashishb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution.

@ashishb
Copy link
Owner

ashishb commented Sep 4, 2024

@lawrencegripper did you mistakenly mark this as a draft?

@lawrencegripper
Copy link
Contributor Author

lawrencegripper commented Sep 4, 2024

Thanks for the contribution.

No worries thanks for the tool, it's awesome.

@lawrencegripper did you mistakenly mark this as a draft?

I'm still testing it out on my blog that I'm migrating. I've hit a few other entries where I use [gist URL] and trying to handle those too.

Thanks for the 👀 - will be back shortly with updated version.

@lawrencegripper
Copy link
Contributor Author

🤞 this is good to go, it now handles gists that where added with new block editor and gists added with the old markdown syntax

<figure class="wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler"><div class="wp-block-embed__wrapper">
https://gist.github.com/lawrencegripper/8e701b0d201e65af0f8bc9b8b0b14207
</div></figure>

AND

<body>
some text
\[gist https://gist.github.com/lawrencegripper/6bee7de123bea1936359\]
some more text
</body>

@lawrencegripper lawrencegripper marked this pull request as ready for review September 4, 2024 19:30
@ashishb
Copy link
Owner

ashishb commented Sep 4, 2024

@lawrencegripper there are a few linter issues before this can be merged in

Running [/home/runner/golangci-lint-1.60.3-linux-amd64/golangci-lint run --path-prefix=src/wp2hugo] in [/home/runner/work/wp2hugo/wp2hugo/src/wp2hugo] ...
  Error: src/wp2hugo/internal/hugogenerator/hugopage/html_to_markdown_converter.go:129:6: func `handleBlockEditorImages` is unused (unused)
  func handleBlockEditorImages() md.Plugin {
       ^
  Error: src/wp2hugo/internal/hugogenerator/hugopage/html_to_markdown_converter_test.go:31:7: const `_textBlockEditorImg` is unused (unused)
  const _textBlockEditorImg = `
        ^
  Error: issues found

Ref: https://github.com/ashishb/wp2hugo/actions/runs/10709341180/job/29693758685?pr=39

@lawrencegripper
Copy link
Contributor Author

I hit an issue with img's that where added view the new block editor. The src has ?w=1024 appended which causes the file downloaded to be image.png?w=1024 and this doesn't work with hugo serve.

image

I've used a similar approach to find figure with wp-image and remove the appended param so things work nicely.

I can split this one out into a different PR if you'd prefer

@lawrencegripper
Copy link
Contributor Author

@lawrencegripper there are a few linter issues before this can be merged in

Linting issues should be fixed now 🤞

@ashishb
Copy link
Owner

ashishb commented Sep 4, 2024

I hit an issue with img's that where added view the new block editor. The src has ?w=1024 appended which causes the file downloaded to be image.png?w=1024 and this doesn't work with hugo serve.

Huge variance here

I can split this one out into a different PR if you'd prefer

Yeah, that would be preferable.

@ashishb ashishb merged commit 6d4a65a into ashishb:main Sep 4, 2024
3 checks passed
lawrencegripper added a commit to lawrencegripper/gripdev.xyz that referenced this pull request Sep 4, 2024
1. Run wp2hugo with PR ashishb/wp2hugo#39
2. Remove drafts with `grep --recursive 'draft: "true"' ./generated-2024-09-04-20-28-34 -l | xargs -n 1 rm`
3. Manually remove old pages
4. Add .gitignore
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