You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Angular package currently uses @Input() decorators and constructor injection everywhere. I would like to do a modernization pass: signal inputs via input(), inject() instead of constructors, and computed() where it makes sense.
There is one catch: signal inputs are stable since Angular 19, and the package currently allows >=17. So this would raise the minimum supported Angular version. That is your call as maintainers, which is why I'm asking here first instead of just sending a PR.
For consumers nothing changes. Props on custom components are already set via setInput(), and that works the same with signal inputs.
If you're open to this, let me know which Angular version you're comfortable with as the new minimum and I'll prepare the PR. I would keep it separate from the bug fixes (#294, #295) so those can land independently.
PR: #446 — migrate to signal inputs and ng-packagr
It covers everything proposed here:
Signal inputs — @Input() → input() across Markdown, MarkdownDocument, MarkdownNode, Binding, Math and Mermaid components
inject() instead of constructor injection, plus computed() where it made sense
Build migration to ng-packagr — the hand-rolled ngc pipeline is gone; component plugins are now secondary entry points (plugins/binding, plugins/math, plugins/mermaid)
Minimum Angular raised to v19, as agreed in this thread (peer deps now >=19 <23)
For consumers nothing changes: props on custom components are still set via setInput().
Follow-up on defineMarkdownComponent / defineMarkdownDocumentComponent, before this lands in #446. This one part needs your input because it is a breaking change, and the "for consumers nothing changes" note above does not cover it.
The current helpers return a component class created inside a factory (a @Component subclass built by the function). That pattern is not AOT-compatible: putting the factory result in another component's imports: triggers ngtsc error -991010 ("value could not be determined statically"). It works in dev (JIT) but breaks production builds, so it can't be the recommended API.
Proposed change: make the helpers return a config Provider, and read that config in the static Markdown / MarkdownDocument components via an InjectionToken:
@Component({standalone: true,imports: [Markdown],// static, AOT-safeproviders: [defineMarkdownComponent({// same helper, same optionsplugins: [math()],components: { Math },class: 'prose dark:prose-invert',})],template: ` <comark-markdown [value]="content" [streaming]="true" [caret]="true" /> `,})
All the existing per-instance inputs (value, options, plugins, components, unwrap, summary, streaming, caret, data) keep working as before. Instance inputs win over the config, so the provider is purely the pre-configured baseline.
This removes the extra comark-markdown-document / comark-markdown-node wrappers from the final DOM while preserving the rendered content and Angular component behavior. The attached output shows the before/after DOM difference across the syntax showcase.
The implementation is ready and verified locally (60 tests passing, clean AOT build of the example app). I haven't committed it to #446 yet because I'd like to confirm the API direction first.
Would the maintainers be OK with this direction (the helper returns a Provider instead of Type<Markdown>), or would you prefer a different shape? Happy to adjust.
Activity
atinux commentedon Jul 28, 2026
What do you think @arashsheyda ?
arashsheyda commentedon Jul 31, 2026
I think it would be a good idea to change the minimum to v19 🚀
atinux commentedon Aug 12, 2026
Could we close this issue too as #346 is merged?
schplitt commentedon Aug 12, 2026
I wouldn't say so to be honest.
A lot of modern angular features are not used currently.
I would be very in favor of it (though this would raise the minimal version for Angular to 19).
I'm unsure if you would be in favor of that or not.
If so let me know and I will look into it myself.
arashsheyda commentedon Aug 13, 2026
@schplitt do you want to open a PR so we can review?
adrian-ub commentedon Sep 17, 2026
Hey there! I started working on this
PR: #446 — migrate to signal inputs and ng-packagr
It covers everything proposed here:
@Input()→input()acrossMarkdown,MarkdownDocument,MarkdownNode,Binding,MathandMermaidcomponentsinject()instead of constructor injection, pluscomputed()where it made senseng-packagr— the hand-rolledngcpipeline is gone; component plugins are now secondary entry points (plugins/binding,plugins/math,plugins/mermaid)>=19 <23)For consumers nothing changes: props on custom components are still set via
setInput().Happy to adjust anything — would love a review!
cc @arashsheyda @farnabaz @atinux @schplitt
adrian-ub commentedon Sep 18, 2026
Follow-up on
defineMarkdownComponent/defineMarkdownDocumentComponent, before this lands in #446. This one part needs your input because it is a breaking change, and the "for consumers nothing changes" note above does not cover it.The current helpers return a component class created inside a factory (a
@Componentsubclass built by the function). That pattern is not AOT-compatible: putting the factory result in another component'simports:triggers ngtsc error -991010 ("value could not be determined statically"). It works in dev (JIT) but breaks production builds, so it can't be the recommended API.Proposed change: make the helpers return a config Provider, and read that config in the static
Markdown/MarkdownDocumentcomponents via anInjectionToken:All the existing per-instance inputs (
value,options,plugins,components,unwrap,summary,streaming,caret,data) keep working as before. Instance inputs win over the config, so the provider is purely the pre-configured baseline.Sketch of how the components read the provider:
There is a branch with the complete implementation if you'd like to try it directly:
https://github.com/adrian-ub/comarkdown-comark/tree/feat/angular-provider-config
The branch also removes the need for consumers to explicitly import
@angular/compiler.Additionally, while working on this, I cleaned up the rendered DOM structure. Instead of producing several internal wrapper elements such as:
the rendered output can now be reduced to:
This removes the extra
comark-markdown-document/comark-markdown-nodewrappers from the final DOM while preserving the rendered content and Angular component behavior. The attached output shows the before/after DOM difference across the syntax showcase.The implementation is ready and verified locally (60 tests passing, clean AOT build of the example app). I haven't committed it to #446 yet because I'd like to confirm the API direction first.
Would the maintainers be OK with this direction (the helper returns a
Providerinstead ofType<Markdown>), or would you prefer a different shape? Happy to adjust.