Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ asresources = gnome.compile_resources(
c_name: 'as'
)

dep_libmarkdown = dependency('libmarkdown', version : '>= 3.0.0')
if dep_libmarkdown.found()
add_project_arguments('-D', 'MARKDOWN3', language: 'vala')
endif

subdir('src')

executable(
Expand Down
12 changes: 9 additions & 3 deletions src/Widgets/Viewer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,16 @@ public class ENotes.Viewer : WebKit.WebView {

private string process (string raw_mk) {
string processed_mk;
//Extra Footnote + Autolink + ``` code + Extra def lists + keep style + LaTeX
int flags = 0x00200000 + 0x00004000 + 0x02000000 + 0x01000000 + 0x00400000 + 0x40000000;
process_frontmatter (raw_mk, out processed_mk);
//Extra Footnote + Autolink + ``` code + Extra def lists + keep style + LaTeX
var mkd = new Markdown.Document.from_string (processed_mk.data, 0x00200000 + 0x00004000 + 0x02000000 + 0x01000000 + 0x00400000 + 0x40000000);
mkd.compile (0x00200000 + 0x00004000 + 0x02000000 + 0x01000000 + 0x00400000 + 0x40000000);
#if MARKDOWN3
var mkd = new Markdown.Document.from_string (processed_mk.data, &flags);
mkd.compile (&flags);
#else
var mkd = new Markdown.Document.from_string (flags);
mkd.compile (flags);
#endif

string result;
mkd.document (out result);
Expand Down
9 changes: 8 additions & 1 deletion vapi/libmarkdown.vapi
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,23 @@ namespace Markdown
[CCode (cname = "mkd_in")]
public Document.from_in (GLib.FileStream file, DocumentFlags flags);
[CCode (cname = "mkd_string")]
#if MARKDOWN3
public Document.from_string (uint8[] doc, DocumentFlags * flags);
#else
public Document.from_string (uint8[] doc, DocumentFlags flags);

#endif
[CCode (cname = "gfm_in")]
public Document.from_gfm_in (GLib.FileStream file, DocumentFlags flags);
[CCode (cname = "gfm_string")]
public Document.from_gfm_string (uint8[] doc, DocumentFlags flags);

public void basename (string @base);

#if MARKDOWN3
public bool compile (DocumentFlags * flags);
#else
public bool compile (DocumentFlags flags);
#endif
public void cleanup ();

public int dump (GLib.FileStream file, DocumentFlags flags, string title);
Expand Down