1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-13 00:10:37 +02:00

Updated doc

This commit is contained in:
Laurent Cozic
2020-10-20 20:05:31 +01:00
parent 98bf3bde8d
commit 9f7ea7d865
2 changed files with 23 additions and 14 deletions

View File

@ -58,6 +58,8 @@ export default class JoplinPlugins {
* *
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/content_script) * [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/content_script)
* *
* @param type Defines how the script will be used. See the type definition for more information about each supported type.
* @param id A unique ID for the content script.
* @param scriptPath Must be a path relative to the plugin main script. For example, if your file content_script.js is next to your index.ts file, you would set `scriptPath` to `"./content_script.js`. * @param scriptPath Must be a path relative to the plugin main script. For example, if your file content_script.js is next to your index.ts file, you would set `scriptPath` to `"./content_script.js`.
*/ */
async registerContentScript(type:ContentScriptType, id:string, scriptPath:string) { async registerContentScript(type:ContentScriptType, id:string, scriptPath:string) {

View File

@ -322,22 +322,27 @@ export enum ContentScriptType {
* Registers a new Markdown-It plugin, which should follow this template: * Registers a new Markdown-It plugin, which should follow this template:
* *
* ```javascript * ```javascript
* * // The module should export an object as below:
* // The module should export an object like below:
* *
* module.exports = { * module.exports = {
* default: {
* // This is the actual Markdown-It plugin - check the [official doc](https://github.com/markdown-it/markdown-it) for more information
* // The `options` parameter is of type [RuleOptions](https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/joplin-renderer/MdToHtml.ts), which
* // contains a number of options, mostly useful for Joplin's internal code.
* plugin: function(markdownIt, options) {
* *
* }, * // The "context" variable is currently unused but could be used later on to provide
* // access to your own plugin so that the content script and plugin can communicate.
* default: function(context) {
* return {
* *
* // You may also specify additional assets such as JS or CSS that should be loaded in the rendered HTML document. * // This is the actual Markdown-It plugin - check the [official doc](https://github.com/markdown-it/markdown-it) for more information
* // Check for example the Joplin [Mermaid plugin](https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/mermaid.ts) to * // The `options` parameter is of type [RuleOptions](https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/joplin-renderer/MdToHtml.ts), which
* // see how the data should be structured. * // contains a number of options, mostly useful for Joplin's internal code.
* assets: {}, * plugin: function(markdownIt, options) {
* // ...
* },
*
* // You may also specify additional assets such as JS or CSS that should be loaded in the rendered HTML document.
* // Check for example the Joplin [Mermaid plugin](https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/mermaid.ts) to
* // see how the data should be structured.
* assets: {},
* }
* } * }
* } * }
* ``` * ```
@ -347,8 +352,10 @@ export enum ContentScriptType {
* *
* ```javascript * ```javascript
* module.exports = { * module.exports = {
* default: { * default: function(context) {
* plugin: require('markdown-it-toc-done-right'); * return {
* plugin: require('markdown-it-toc-done-right');
* }
* } * }
* } * }
* ``` * ```