Skip to content

Commit

Permalink
More markdown fixes...
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed Jan 29, 2023
1 parent df9c65d commit 8bde820
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 51 deletions.
48 changes: 1 addition & 47 deletions scripts/__scribble_get_state/__scribble_get_state.gml
Original file line number Diff line number Diff line change
Expand Up @@ -19,53 +19,7 @@ function __scribble_get_state()

__msdf_thickness_offset: 0,

__markdown_styles_struct: {
body: {
},

header1: {
bold: true,
italic: true,
scale: 1.6,
},

header2: {
bold: true,
scale: 1.4,
},

header3: {
italic: true,
scale: 1.2,
},

quote: {
color: #E7E7E7,
italic: true,
scale: 0.9,
prefix: " ",
},

bold: {
bold: true,
},

italic: {
italic: true,
},

bold_italic: {
bold: true,
italic: true,
},

bullet_sprite: scribble_fallback_bulletpoint,

link: {
bold: true,
color: #DF9FFF,
},
},
__markdown_styles_struct: {},
};

return _struct;
Expand Down
56 changes: 52 additions & 4 deletions scripts/scribble_markdown_format/scribble_markdown_format.gml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
{\
_write_style = false;\
;\
var _old_style_struct = (_old_style == undefined)? _empty_struct : (_markdown_styles_struct[$ _old_style] ?? _empty_struct);\
var _new_style_struct = _markdown_styles_struct[$ _new_style] ?? _empty_struct;\
var _old_style_struct = (_old_style == undefined)? _empty_struct : (_markdown_styles_struct[$ _old_style] ?? _fallback_styles_struct[$ _old_style]);\
var _new_style_struct = _markdown_styles_struct[$ _new_style] ?? _fallback_styles_struct[$ _new_style];\
;\
var _insert_string = _old_style_struct[$ "suffix"] ?? "";\
;\
Expand Down Expand Up @@ -160,7 +160,56 @@ function scribble_markdown_format(_string)
}

static _empty_struct = {};
static _markdown_styles_struct = __scribble_get_state().__markdown_styles_struct;

var _fallback_styles_struct = {
body: {
},

header1: {
bold: true,
italic: true,
scale: 1.6,
},

header2: {
bold: true,
scale: 1.4,
},

header3: {
italic: true,
scale: 1.2,
},

quote: {
color: #E7E7E7,
italic: true,
scale: 0.9,
prefix: " ",
},

bold: {
bold: true,
},

italic: {
italic: true,
},

bold_italic: {
bold: true,
italic: true,
},

bullet_sprite: scribble_fallback_bulletpoint,

link: {
bold: true,
color: #DF9FFF,
},
};

var _markdown_styles_struct = __scribble_get_state().__markdown_styles_struct;

static _buffer = __scribble_get_buffer_a();

Expand Down Expand Up @@ -315,7 +364,6 @@ function scribble_markdown_format(_string)
_buffer_size += _func_delete_and_insert_buffer(_buffer, _buffer_size, 2, (_bullet_sprite == undefined)? "- [indent]" : "[" + sprite_get_name(_bullet_sprite) + "] [indent]");
}

buffer_seek(_buffer, buffer_seek_relative, 1);
__SCRIBBLE_MARKDOWN_UPDATE_NEXT_VALUE

_newline = false;
Expand Down

0 comments on commit 8bde820

Please sign in to comment.