question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

add doc of best practices for writing plugins

See original GitHub issue

I think this would probably be useful, keeping track of some best practices:

  • Always write plugins as a function that takes an options object, for future-proofing.
  • When accepting defaultBlock/Mark/etc. arguments, use the Node.create() and Node.createProperties() static methods for standardizing these, just like core does.
  • When allowing customization of what changes will actually be applied to the document, use a change function with signature (change, ...args) like core does.

If anyone thinks of others, feel free to add them here so we don’t forget!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ianstormtaylorcommented, Sep 13, 2017

@oyeanuj Ah yes agreed! Actually I realized that I want to change up how those work by creating a separate plugin soon called slate-only-in that you can wrap any other plugins with. That way it doesn’t have to be repeated in all plugins code bases

0reactions
ianstormtaylorcommented, Oct 26, 2017

Added to the Plugins guide!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best Practices | Plugin Developer Handbook
Here are some best practices to help organize your code so it works well alongside WordPress core and other WordPress plugins.
Read more >
Best Practices for Plugin Development — Omeka 2.7 ...
Best Practices for Plugin Development¶ · Method Naming Conventions¶ · Maintain expected behaviors in Omeka¶ · Database changes¶ · Record API¶ · Use...
Read more >
Documentation Best Practices: Guide To Make It Effective
Check this blog to learn documentation best practices that you need to know before creating knowledge base for your company.
Read more >
Best practices for writing extensions - CKAN documentation
Try to limit your extension to interacting with CKAN only through CKAN's plugin interfaces and plugins toolkit. It's a good idea to keep...
Read more >
Tutorial: Write and register a plug-in - Microsoft Learn
Edit the class file to enable a plug-in. Add the following using statements to the top of the FollowupPlugin.cs file: C#
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found