Skip to content

Commit 30b778c

Browse files
committed
docs: add @permission kdoc to stdlib functions
1 parent 18c97ba commit 30b778c

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

quarkdown-stdlib/src/main/kotlin/com/quarkdown/stdlib/Bibliography.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import com.quarkdown.core.function.reflect.annotation.LikelyNamed
1515
import com.quarkdown.core.function.reflect.annotation.Name
1616
import com.quarkdown.core.function.value.NodeValue
1717
import com.quarkdown.core.function.value.wrappedAsValue
18+
import com.quarkdown.core.permissions.Permission
1819

1920
/**
2021
* `Bibliography` stdlib module exporter.
@@ -64,6 +65,8 @@ private const val DEFAULT_CSL_STYLE = "ieee"
6465
* @see cite to cite bibliography entries
6566
* @throws java.io.IOException if the bibliography file cannot be read or parsed
6667
* @throws IllegalArgumentException if the specified style does not exist or is invalid
68+
* @permission [Permission.ProjectRead] to read bibliography files located in the project directory
69+
* @permission [Permission.GlobalRead] to read bibliography files located outside the project directory
6770
* @wiki Bibliography
6871
*/
6972
fun bibliography(

quarkdown-stdlib/src/main/kotlin/com/quarkdown/stdlib/Data.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import com.quarkdown.core.function.value.data.Range
2323
import com.quarkdown.core.function.value.data.subList
2424
import com.quarkdown.core.function.value.factory.ValueFactory
2525
import com.quarkdown.core.function.value.wrappedAsValue
26+
import com.quarkdown.core.permissions.Permission
2627
import com.quarkdown.core.permissions.requireReadPermission
2728
import com.quarkdown.core.util.normalizeLineSeparators
2829
import com.quarkdown.stdlib.internal.AlphanumericComparator
@@ -71,6 +72,8 @@ internal fun file(
7172
* @param lineRange range of lines to extract from the file.
7273
* If not specified or infinite, the whole file is read
7374
* @return a string value of the text extracted from the file
75+
* @permission [Permission.ProjectRead] to read files located in the project directory
76+
* @permission [Permission.GlobalRead] to read files located outside the project directory
7477
* @throws IllegalArgumentException if [lineRange] is out of bounds
7578
* @wiki File data
7679
*/
@@ -196,6 +199,8 @@ enum class FileSorting(
196199
* @param order order to sort the files in
197200
* @return an unordered collection of string values, each representing a file located in the directory, with extension
198201
* @throws IllegalArgumentException if the directory does not exist or if the path is not a directory
202+
* @permission [Permission.ProjectRead] to list files located in the project directory
203+
* @permission [Permission.GlobalRead] to list files located outside the project directory
199204
* @see fileName to exclude the extension from file names
200205
* @wiki File data
201206
*/
@@ -239,6 +244,8 @@ fun listFiles(
239244
* @param includeExtension whether to include the file extension in the name
240245
* @return the name of the file located in [path]
241246
* @throws IllegalArgumentException if the file does not exist
247+
* @permission [Permission.ProjectRead] to access files located in the project directory
248+
* @permission [Permission.GlobalRead] to access files located outside the project directory
242249
* @wiki File data
243250
*/
244251
@Name("filename")
@@ -273,6 +280,8 @@ enum class CsvParsingMode(
273280
* @param caption optional caption of the table. If set, the table will be numbered according to the current [numbering] format
274281
* @param referenceId optional ID for cross-referencing via [reference]
275282
* @return a table whose content is loaded from the file located in [path]
283+
* @permission [Permission.ProjectRead] to read CSV files located in the project directory
284+
* @permission [Permission.GlobalRead] to read CSV files located outside the project directory
276285
* @wiki File data
277286
*/
278287
fun csv(

quarkdown-stdlib/src/main/kotlin/com/quarkdown/stdlib/Injection.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ val Injection: QuarkdownModule =
4242
*
4343
* @param content raw HTML content to inject
4444
* @return a new [Html] node
45+
* @permission [Permission.NativeContent] to inject native HTML content
4546
* @throws com.quarkdown.core.permissions.MissingPermissionException if [Permission.NativeContent] is not granted
4647
* @wiki HTML
4748
*/
@@ -73,6 +74,7 @@ fun html(
7374
*
7475
* @param content raw CSS content to inject
7576
* @return a new [Html] node representing the style element
77+
* @permission [Permission.NativeContent] to inject native CSS content
7678
* @throws com.quarkdown.core.permissions.MissingPermissionException if [Permission.NativeContent] is not granted
7779
* @see [cssProperties] for a more structured way to override CSS properties.
7880
* @wiki CSS
@@ -107,8 +109,9 @@ private const val CSS_PROPERTY_PREFIX = "--qd-"
107109
* without any additional processing or escaping, as long as the rendering target supports HTML.
108110
*
109111
* @param properties a dictionary of CSS property names and their values
110-
* @throws com.quarkdown.core.permissions.MissingPermissionException if [Permission.NativeContent] is not granted
111112
* @return a new [Html] node representing the style element
113+
* @permission [Permission.NativeContent] to inject native CSS properties
114+
* @throws com.quarkdown.core.permissions.MissingPermissionException if [Permission.NativeContent] is not granted
112115
* @wiki CSS
113116
*/
114117
@Name("cssproperties")

0 commit comments

Comments
 (0)