Hacker News new | past | comments | ask | show | jobs | submit login

Yes, this is possible with language injection[0]

[0] https://tree-sitter.github.io/tree-sitter/syntax-highlightin...




Does this cover things like separating leading /// comment indicators? That’s something Vim’s :syn-include can’t cope with.

  /// This is Markdown-in-Rust.
  ///
  /// ```rust
  /// // This is Rust-in-Markdown-in-Rust.
  /// /// This is Markdown-in-Rust-in-Markdown-in-Rust.
  /// const RUST_IN_MARKDOWN_IN_RUST: &'static str = "
  ///     In this multi-line string (as the most common example of such token-mixing),
  ///     those triple slashes are Comment, not String.";
  /// // And if Trait and Type get parsed carefully below, the /// must not interrupt that.
  /// impl
  /// Trait
  /// for
  /// Type {}
  /// ```
  struct ThisIsRust;
The remark about injection.include-children in your link suggests it can, but I don’t know enough about it yet to be confident of that preliminary assessment.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: