-
-This uses puppeteer to navigate through your starred topics page.
+
#### ➡️ Available options
@@ -26,7 +33,8 @@ This uses puppeteer to navigate through your starred topics page.
plugin_topics
-
Display starred topics
+
Enable topics plugin
+
type:boolean
@@ -35,17 +43,31 @@ This uses puppeteer to navigate through your starred topics page.
plugin_topics_mode
-
Plugin mode
+
Display mode:
+
+
labels: display labels
+
icons: display icons (topics without icons will be ignored)
+
starred: alias for labels
+
mastered: alias for icons
+
+
type:string default: starred
-allowed values:
starred
icons
mastered
+allowed values:
labels
icons
starred
mastered
plugin_topics_sort
-
Sorting method of starred topics
+
Sorting method:
+
+
stars: sort by most stars
+
activity: sort by recent activity
+
starred: sort by the date you starred them
+
random: sort topics randomly
+
+
type:string
@@ -55,7 +77,9 @@ This uses puppeteer to navigate through your starred topics page.
plugin_topics_limit
-
Maximum number of topics to display
+
Display limit
+
When using plugin_topics_mode: labels, an ellipsis will be displayed
+
type:number
@@ -63,6 +87,7 @@ This uses puppeteer to navigate through your starred topics page.
𝑥
≤ 20)
+zero behaviour: disable
default: 15
diff --git a/source/plugins/topics/index.mjs b/source/plugins/topics/index.mjs
index 8fc3fa35..e9a81fb1 100644
--- a/source/plugins/topics/index.mjs
+++ b/source/plugins/topics/index.mjs
@@ -8,6 +8,7 @@ export default async function({login, data, imports, q, account}, {enabled = fal
//Load inputs
let {sort, mode, limit} = imports.metadata.plugins.topics.inputs({data, account, q})
+ const type = {starred:"labels", labels:"labels", mastered:"icons", icons:"icons"}[mode]
const shuffle = (sort === "random")
//Start puppeteer and navigate to topics
@@ -51,8 +52,8 @@ export default async function({login, data, imports, q, account}, {enabled = fal
topics = imports.shuffle(topics)
}
- //Limit topics (starred mode)
- if ((mode === "starred") && (limit > 0)) {
+ //Limit topics (labels)
+ if ((type === "labels") && (limit > 0)) {
console.debug(`metrics/compute/${login}/plugins > topics > keeping only ${limit} topics`)
const removed = topics.splice(limit)
if (removed.length)
@@ -72,14 +73,14 @@ export default async function({login, data, imports, q, account}, {enabled = fal
topic.description = imports.htmlescape(topic.description)
}
- //Filter topics with icon (mastered mode)
- if (mode === "mastered") {
+ //Filter topics with icon (icons)
+ if (type === "icons") {
console.debug(`metrics/compute/${login}/plugins > topics > filtering topics with icon`)
topics = topics.filter(({icon}) => icon)
}
- //Limit topics (mastered mode)
- if ((mode === "mastered") && (limit > 0)) {
+ //Limit topics (icons)
+ if ((type === "icons") && (limit > 0)) {
console.debug(`metrics/compute/${login}/plugins > topics > keeping only ${limit} topics`)
topics.splice(limit)
}
diff --git a/source/plugins/topics/metadata.yml b/source/plugins/topics/metadata.yml
index e8a52a1b..a4db24a9 100644
--- a/source/plugins/topics/metadata.yml
+++ b/source/plugins/topics/metadata.yml
@@ -1,44 +1,59 @@
name: "📌 Starred topics"
category: github
+description: |
+ This plugin displays [starred topics](https://github.com/stars?filter=topics).
+ Check out [GitHub topics](https://github.com/topics) to search interesting topics.
+examples:
+ +with icons: https://github.com/lowlighter/metrics/blob/examples/metrics.plugin.topics.icons.svg
+ +with labels: https://github.com/lowlighter/metrics/blob/examples/metrics.plugin.topics.svg
index: 2
supports:
- user
scopes: []
inputs:
- # Enable or disable plugin
plugin_topics:
- description: Display starred topics
+ description: Enable topics plugin
type: boolean
default: no
- # Plugin mode
plugin_topics_mode:
- description: Plugin mode
+ description: |
+ Display mode:
+ - `labels`: display labels
+ - `icons`: display icons *(topics without icons will be ignored)*
+ - `starred`: alias for `labels`
+ - `mastered`: alias for `icons`
type: string
default: starred
values:
- - starred # Display starred topics as labels
- - icons # Display starred topics as icons
- - mastered # Display starred topics as mastered/known technologies icons
+ - labels
+ - icons
+ - starred
+ - mastered
- # Topics sorting order
plugin_topics_sort:
- description: Sorting method of starred topics
+ description: |
+ Sorting method:
+ - `stars`: sort by most stars
+ - `activity`: sort by recent activity
+ - `starred`: sort by the date you starred them
+ - `random`: sort topics randomly
type: string
default: stars
values:
- - stars # Sort topics by stargazers
- - activity # Sort topics by recent activity
- - starred # Sort topics by the date you starred them
- - random # Sort topics randomly
+ - stars
+ - activity
+ - starred
+ - random
- # Number of topics to display
- # Set to 0 to disable limitations
- # When in "starred" mode, additional topics will be grouped into an ellipsis
plugin_topics_limit:
- description: Maximum number of topics to display
+ description: |
+ Display limit
+
+ When using `plugin_topics_mode: labels`, an ellipsis will be displayed
type: number
default: 15
min: 0
- max: 20
\ No newline at end of file
+ max: 20
+ zero: disable
\ No newline at end of file
diff --git a/source/templates/classic/partials/topics.ejs b/source/templates/classic/partials/topics.ejs
index 3be1d782..092334ec 100644
--- a/source/templates/classic/partials/topics.ejs
+++ b/source/templates/classic/partials/topics.ejs
@@ -2,7 +2,7 @@