diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2018-11-27 03:20:19 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2018-11-27 03:20:19 +0000 |
| commit | faa0a0ebf36a3d42517b4cdffddfb9251b57e124 (patch) | |
| tree | 58cf1bf9b31b74111fc41972efbbe2bc1bbea856 | |
| parent | fix markdown+span on client (diff) | |
| download | mmm-faa0a0ebf36a3d42517b4cdffddfb9251b57e124.tar.gz mmm-faa0a0ebf36a3d42517b4cdffddfb9251b57e124.zip | |
style images in markdown only
| -rw-r--r-- | mmm/mmmfs/conversion.moon | 13 | ||||
| -rw-r--r-- | scss/_content.scss | 16 |
2 files changed, 17 insertions, 12 deletions
diff --git a/mmm/mmmfs/conversion.moon b/mmm/mmmfs/conversion.moon index 9e98ffa..23df3f0 100644 --- a/mmm/mmmfs/conversion.moon +++ b/mmm/mmmfs/conversion.moon @@ -42,7 +42,7 @@ converts = { out: 'mmm/dom', transform: if MODE == 'SERVER' (html, fileder) -> - div html\gsub '<mmm%-embed%s+(.-)></mmm%-embed>', (attrs) -> + html\gsub '<mmm%-embed%s+(.-)></mmm%-embed>', (attrs) -> path, facet = '', '' opts = {} while attrs and attrs != '' @@ -62,7 +62,7 @@ converts = { embed path, facet, fileder, opts else (html, fileder) -> - with document\createElement 'div' + parent = with document\createElement 'div' .innerHTML = html -- copy to iterate safely, HTMLCollections update when nodes are GC'ed @@ -74,6 +74,9 @@ converts = { nolink = js_fix element\getAttribute 'nolink' element\replaceWith embed path, facet, fileder, { :nolink } + + assert 1 == parent.childElementCount, "text/html with more than one child!" + parent.firstElementChild }, { inp: 'text/lua -> (.+)', @@ -142,7 +145,7 @@ converts = { out: 'mmm/dom', transform: (src) -> -- @TODO: add parsed MIME type - video (source :src), controls: true + video (source :src), controls: true, loop: true }, { inp: 'text/plain', @@ -193,7 +196,7 @@ do warn "NO MARKDOWN SUPPORT!", discount markdown = success and (md) -> - res, err = discount.compile md, 'githubtags' + res = assert discount.compile md, 'githubtags' res.body else markdown = window and window.marked and window\marked @@ -202,7 +205,7 @@ do table.insert converts, { inp: 'text/markdown', out: 'text/html', - transform: single markdown + transform: (md) -> "<div class=\"markdown\">#{markdown md}</div>" } table.insert converts, { diff --git a/scss/_content.scss b/scss/_content.scss index 0272508..f953c01 100644 --- a/scss/_content.scss +++ b/scss/_content.scss @@ -1,11 +1,13 @@ .content { - img, video { - display: block; - max-width: 100%; - max-height: 50vh; - - padding: 0 2em; - box-sizing: border-box; + .markdown { + img, video { + display: block; + max-width: 100%; + max-height: 50vh; + + padding: 0 2em; + box-sizing: border-box; + } } pre > code { |
