You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add setup function with improved documentation
Add a proper setup function to initialize the plugin. The setup
function creates necessary autocommands and validates API key.
Type annotations were updated to improve developer experience:
- @Class and @field annotations for Article, Author, FeedArticle
- @param and @return annotations for all functions
- Changed vim.fn.json_decode to vim.json.decode
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
1
localM= {}
3
2
4
-
-- TODO: Create class for Article
3
+
---@classArticle
4
+
---@fieldidnumber
5
+
---@fieldtype_ofstring
6
+
---@fieldtitlestring
7
+
---@fieldslugstring
8
+
---@fielddescriptionstring
9
+
---@fieldurlstring
10
+
---@fieldbody_markdownstring?
11
+
---@fielduserAuthor
12
+
---@fieldreading_time_minutesnumber
13
+
---@fieldtagsstring[]
14
+
---@fieldpositive_reactions_countnumber
15
+
---@fieldcomments_countnumber
16
+
---@fieldreadable_publish_datestring
17
+
---@fieldpublished_atstring?
5
18
19
+
---@classAuthor
20
+
---@fieldnamestring
21
+
---@fieldusernamestring
22
+
23
+
--- Get the lines of the body of an article
24
+
--- @paramarticleArticle
25
+
--- @returnstring[]
6
26
functionM.get_body_lines(article)
7
27
returnvim.split(article.body_markdownor"", "\n")
8
28
end
9
29
30
+
--- Get the template for a new article
31
+
--- @paramtitlestring The title of the new article
32
+
--- @returnstring
10
33
functionM.get_template(title)
11
-
return ("---\ntitle: " ..title) ..
12
-
"\npublished: false\ndescription:\ntags:\n# cover_image: https://direct_url_to_image.jpg\n# Use a ratio of 100:42 for best results.\n---\n\n"
34
+
returnstring.format(
35
+
"---\ntitle: %s\npublished: false\ndescription:\ntags:\n# cover_image: https://direct_url_to_image.jpg\n# Use a ratio of 100:42 for best results.\n---\n\n",
0 commit comments