Skip to content

Conversation

@TheNightmanCodeth
Copy link

This PR adds an argument to .installPlugin that takes a set of custom Grammars to use while highlighting code in markdown.

Let's say we've created a custom Grammar called YamlGrammar. We can use it with this PR like so:

.installPlugin(.splash(withClassPrefix: "", withGrammars: [(YamlGrammar(), "yaml"), (SwiftGrammar(), "swift")])

This will apply the grammar to any code blocks in markdown prepended with "yaml", like so:

```yaml
...

I wrote a unit test but I did struggle getting Xcode to recognize the string to compare with. I had to escape some quotes and add newlines to get it working even though I noticed this wasn't done in the first unit test. Hope that's okay!

I also took the liberty of adding brief instructions to the README. Hopefully it reads well 😂

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.

1 participant