mm-mark 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
1
+ name: Publish
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+
11
+ permissions:
12
+ contents: read
13
+ id-token: write
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Install dependencies
19
+ run: npm install
20
+
21
+ - name: Publish package
22
+ run: npx jsr publish
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # mm-mark
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Remove ptm frontmatter
8
+
3
9
  ## 0.2.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -1,29 +1,128 @@
1
1
  import showdown from 'showdown';
2
2
 
3
+ /**
4
+ * Convert markdown file to HTML content.
5
+ * ----------
6
+ *
7
+ * ***Base on Showndown JS and TeX, LaTeX, MathMl, Prism JS are support.***
8
+ *
9
+ * @example
10
+ * const converter = new Converter(_PATH_TO_MARKDOWN_FILE);
11
+ *
12
+ *
13
+ *
14
+ * @return
15
+ * - json : {data: *frontmatter*, content: markdown content(before convert)}
16
+ * - data : frontmatter , default date and title
17
+ * - content : markdown content(before convert)
18
+ * - postTitle : Title of post from data(frontmatter)
19
+ * - postDate : Posted date from data(frontmatter)
20
+ * - lastUpdatedDate : Last updated date of content
21
+ * - readingTime : Reading time of content
22
+ * - convertedContent : Converted content.
23
+ * - postHtml : HTML with convertedContent , postTitle ,
24
+ * postDate , lastUpdatedDate , readingTime
25
+ * (for blog post)
26
+ * - pageHtml : HTML with only convertedContent for page
27
+ *
28
+ */
3
29
  declare class Converter {
4
30
  filePath: string;
31
+ /**
32
+ * Creates an instance of the Converter class.
33
+ *
34
+ * @param {string} filePath - The path of the file to be converted.
35
+ */
5
36
  constructor(filePath: string);
37
+ /**
38
+ * Formats a given date string into a specific format.
39
+ * @param date - The date string to be formatted.
40
+ * @returns The formatted date string in the format "Weekday, Day Month Year". For example, "Sat, 01 Jan 2022".
41
+ */
6
42
  formatDate(date: string): string;
43
+ /**
44
+ * Calculates the estimated reading time of a given text.
45
+ *
46
+ * @param {string} text - The text to calculate the reading time for.
47
+ * @return {number} The estimated reading time in minutes.
48
+ */
7
49
  readTime(text: string): number;
50
+ /**
51
+ * Retrieves the last update time of a file.
52
+ *
53
+ * @return {string} The last modified time of the file in ISO string format.
54
+ */
8
55
  lastUpdate(): string;
9
56
  /**
10
57
  * Initializes and configures a showdown.Converter object with specific options and flavor.
11
58
  * @returns {showdown.Converter} The initialized converter object.
12
59
  */
13
60
  convert(): showdown.Converter;
14
- filecontent(): {
15
- data: any;
16
- content: any;
17
- };
61
+ /**
62
+ * Retrieves the content of the file using frontmatter.
63
+ *
64
+ * @return {any} The frontmatter content of the file.
65
+ */
66
+ filecontent(): any;
67
+ /**
68
+ * Retrieves the data from the frontmatter of the file at the specified file path.
69
+ *
70
+ * @return {any} The data retrieved from the frontmatter of the file.
71
+ */
18
72
  get data(): any;
73
+ /**
74
+ * Retrieves the content from the frontmatter of the file at the specified file path.
75
+ *
76
+ * @return {any} The content retrieved from the frontmatter of the file.
77
+ */
19
78
  get content(): any;
79
+ /**
80
+ * Retrieves the post title from the data object.
81
+ *
82
+ * @return {any} The post title.
83
+ */
20
84
  get postTitle(): any;
21
- get postDate(): string;
85
+ /**
86
+ * Retrieves the post date from the data object.
87
+ *
88
+ * @return {any} The post date.
89
+ */
90
+ get postDate(): any;
91
+ /**
92
+ * Retrieves the last updated date of the content.
93
+ *
94
+ * @return {string} The formatted last updated date string.
95
+ */
22
96
  get lastUpdatedDate(): string;
97
+ /**
98
+ * Calculates the estimated reading time of the content and returns it as a formatted string.
99
+ *
100
+ * @return {string} The formatted string representing the reading time.
101
+ */
23
102
  get readingTime(): string;
103
+ /**
104
+ * Returns a JSON string representation of the file content.
105
+ *
106
+ * @return {string} The JSON string representation of the file content.
107
+ */
24
108
  get json(): string;
109
+ /**
110
+ * Returns the converted content of the object as a string.
111
+ *
112
+ * @return {string} The converted content as a string.
113
+ */
25
114
  get convertedContent(): string;
115
+ /**
116
+ * Retrieves the post HTML content with converted content, title, date, reading time, and last update.
117
+ *
118
+ * @return {string} The post HTML content.
119
+ */
26
120
  get postHtml(): string;
121
+ /**
122
+ * Retrieves the page HTML content with converted content, title, date, reading time, and last update.
123
+ *
124
+ * @return {string} The page HTML content.
125
+ */
27
126
  get pageHtml(): string;
28
127
  }
29
128