-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlib.ring
More file actions
42 lines (36 loc) · 1.1 KB
/
lib.ring
File metadata and controls
42 lines (36 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
if isWindows()
loadlib("ring_markdown.dll")
elseif isLinux() or isFreeBSD()
loadlib("libring_markdown.so")
elseif isMacOSX()
loadlib("libring_markdown.dylib")
else
raise("Unsupported OS! You need to build the library for your OS.")
ok
load "src/ring_markdown.rh"
Class Markdown
flags
# Initialize the class with default values
func init
# Default flags for Markdown parsing
flags = MD_DIALECT_GITHUB
# Set custom markdown parsing flags
func setFlags nFlags
if !isNumber(nFlags)
raise("Expected number parameter for flags")
ok
flags = nFlags
# Convert markdown to HTML using configured flags
func toHTML cMarkdown
if !isString(cMarkdown)
raise("Expected string parameter")
ok
return md_html(cMarkdown, flags)
# Parse markdown and get detailed structure
func parse cMarkdown
if !isString(cMarkdown)
raise("Expected string parameter")
ok
aResult = []
md_parse(cMarkdown, aResult)
return aResult