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(vite-plugin-angular): add pipeline to transform analog markdown template #875

Merged
merged 1 commit into from Mar 8, 2024

Conversation

brandonroberts
Copy link
Member

@brandonroberts brandonroberts commented Feb 2, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Which package are you modifying?

  • vite-plugin-angular
  • vite-plugin-nitro
  • astro-angular
  • create-analog
  • router
  • platform
  • content
  • nx-plugin
  • trpc

What is the current behavior?

When using Analog markdown templates, the analog markdown templates use marked and Prism to transform and add syntax highlighting.

Closes #

What is the new behavior?

When using Analog markdown templates, the analog markdown templates can be transformed by using custom markdown template transform functions.

/// <reference types="vitest" />

import { defineConfig } from 'vite';
import analog from '@analogjs/platform';

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
  plugins: [
    analog({
      vite: {
        experimental: {
          supportAnalogFormat: true,
          markdownTemplateTransforms: [
            (content: string, fileName: string) => {
              if (!fileName.includes('.analog') {
                return content;
              }

              // use remark/rehype/shikiji
              const newContent = content.replaceAll('Hello', 'Goodbye');

              return Promise.resolve(newContent);
            }
          ]
        },
      },
    }),
  ],
}));

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

[optional] What gif best describes this PR or how it makes you feel?

Copy link

netlify bot commented Feb 2, 2024

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit e278efa
🔍 Latest deploy log https://app.netlify.com/sites/analog-blog/deploys/65ea88a22c73df00086c2f95
😎 Deploy Preview https://deploy-preview-875--analog-blog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 2, 2024

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit e278efa
🔍 Latest deploy log https://app.netlify.com/sites/analog-app/deploys/65ea88a2e2ec7b0008cdfef3
😎 Deploy Preview https://deploy-preview-875--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 2, 2024

Deploy Preview for analog-ng-app ready!

Name Link
🔨 Latest commit e278efa
🔍 Latest deploy log https://app.netlify.com/sites/analog-ng-app/deploys/65ea88a2e838c200081f0d78
😎 Deploy Preview https://deploy-preview-875--analog-ng-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 2, 2024

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit e278efa
🔍 Latest deploy log https://app.netlify.com/sites/analog-docs/deploys/65ea88a256c2b6000809635a
😎 Deploy Preview https://deploy-preview-875--analog-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Jordan-Hall
Copy link

Love this feature but I'm confused. When I mentioned this and splitting out into .analog you said you don't want to reinvent the compiler but this is what I was thinking

@brandonroberts
Copy link
Member Author

Love this feature but I'm confused. When I mentioned this and splitting out into .analog you said you don't want to reinvent the compiler but this is what I was thinking

To me, there's still a clear divide between Analog and the Angular compiler. Besides using the experimental local compilation we're providing the Angular compiler a spec-compatible component and directive that builds on top of the compiler host.

@Jordan-Hall
Copy link

Love this feature but I'm confused. When I mentioned this and splitting out into .analog you said you don't want to reinvent the compiler but this is what I was thinking

To me, there's still a clear divide between Analog and the Angular compiler. Besides using the experimental local compilation we're providing the Angular compiler a spec-compatible component and directive that builds on top of the compiler host.

O i agree but that's what I was talking about. Not writing a new compiler there no real need these days. 🤣

@brandonroberts brandonroberts force-pushed the feat-markdown-template-transforms branch from 0231625 to e278efa Compare March 8, 2024 03:40
@brandonroberts brandonroberts merged commit 789fa06 into main Mar 8, 2024
23 checks passed
@brandonroberts brandonroberts deleted the feat-markdown-template-transforms branch March 8, 2024 03:56
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.

None yet

2 participants