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

feat(StackBlitz): Add support for StackBlitz #172

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

crutchcorn
Copy link

What: StackBlitz is being added to the list of supported vendors

Why: Many sites may use StackBlitz to embed usage of code samples into their blog. I run one such site myself, and intend to use this plugin once these changes are merged

How: We implement a regex for the functionality behind the embed like other services do

Checklist:

  • Documentation
  • Tests*
  • Ready to be merged

I will be adding documentation once the tests are finally passing - I am asking for help debugging these tests

I am making a WIP PR as I feel that I've ran into a bug somewhere along the line with the tests I wrote. I keep running into the following error:

 FAIL  src/__tests__/transformers/StackBlitz.js
  ● Plugin can transform StackBlitz links

    expect(received).toMatchInlineSnapshot(snapshot)

    Snapshot name: `Plugin can transform StackBlitz links 1`

    - Snapshot  - 1
    + Received  + 1

      <p>https://not-a-stackblitz-url.com</p>
      <p>https://this-is-not-stackblitz.com</p>
      <p>https://this-is-not-stackblitz.com/edit/start-to-source-1-ng-template</p>
      <iframe src="https://stackblitz.com/edit/start-to-source-1-ng-template?embed=1" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>
    - <iframe src="https://stackblitz.com/edit/start-to-source-1-ng-template?embed=1&file=src/app/app.component.ts" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>
    + <iframe src="https://stackblitz.com/edit/start-to-source-1-ng-template?embed=1&#x26;file=src/app/app.component.ts" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>

Notice the "expected" embed=1& vs the "received" embed=1&#x26

I'm not sure why this is happening and I'm not entirely confident that this issue is a result of my code - I'm asking for help figuring this one out 😅

Once initial support for StackBlitz is added, I intend to add further functionality by adding support for optional configuration for StackBlitz embeds

@MichaelDeBoey MichaelDeBoey changed the title [WIP] feat: added initial StackBlitz support feat(StackBlitz): Add support for StackBlitz Apr 11, 2021
@MichaelDeBoey MichaelDeBoey added the ⚙️ StackBlitz Issue or pull request regarding StackBlitz label Apr 11, 2021
@MichaelDeBoey MichaelDeBoey self-assigned this Apr 12, 2021
@crutchcorn
Copy link
Author

@MichaelDeBoey was wondering if you'd had a chance to review?

I'm still admittedly unclear why tests are failing, as I don't see anything that I should necessarily change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚙️ StackBlitz Issue or pull request regarding StackBlitz
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants