added the label to mdparse.reflow, added a README
This commit is contained in:
parent
544af1841f
commit
3a95657d99
8
README.md
Normal file
8
README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# mdbrowser
|
||||||
|
A markdown FRequest browser for OpenComputers.
|
||||||
|
|
||||||
|
## mdparse
|
||||||
|
mdparse is the Markdown parsing library used for mdbrowser. It works under standard Lua as well as OpenComputers.
|
||||||
|
|
||||||
|
- `mdparse.parse(text:string): - table` Parses *text* into a table of tables. Each table should contain a .contents string, and if it is a link, then an .address string.
|
||||||
|
- `mdparse.reflow(text:string, linewidth:number): table, table` - Returns a table of formatted lines, and a table of links, as `{x, y, label, address}`.
|
@ -57,7 +57,7 @@ function md.reflow(text,len)
|
|||||||
if lines[#lines]:len()+v[1]:len()+2 > len then
|
if lines[#lines]:len()+v[1]:len()+2 > len then
|
||||||
lines[#lines+1] = ""
|
lines[#lines+1] = ""
|
||||||
end
|
end
|
||||||
links[#links+1] = {#lines, lines[#lines]:len()+1, v[2]}
|
links[#links+1] = {#lines, lines[#lines]:len()+1, v[1], v[2]}
|
||||||
lines[#lines] = lines[#lines] .. "<"..v[1].."> "
|
lines[#lines] = lines[#lines] .. "<"..v[1].."> "
|
||||||
elseif v[1] == "\n\n" then
|
elseif v[1] == "\n\n" then
|
||||||
lines[#lines+1] = ""
|
lines[#lines+1] = ""
|
||||||
|
Loading…
Reference in New Issue
Block a user