diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2019-10-30 10:51:43 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2019-10-30 11:00:36 +0000 |
| commit | e2a90e81cb7676d4f642268400109883f040ae10 (patch) | |
| tree | 303526859c69675524a4aaf6e7c8c8800080bc99 | |
| parent | small change in why_redirectly (diff) | |
| download | mmm-e2a90e81cb7676d4f642268400109883f040ae10.tar.gz mmm-e2a90e81cb7676d4f642268400109883f040ae10.zip | |
fix embed in static rendered markdown
| -rw-r--r-- | mmm/mmmfs/util.moon | 7 | ||||
| -rw-r--r-- | scss/_content.scss | 10 |
2 files changed, 13 insertions, 4 deletions
diff --git a/mmm/mmmfs/util.moon b/mmm/mmmfs/util.moon index 5c25ed3..89fcc02 100644 --- a/mmm/mmmfs/util.moon +++ b/mmm/mmmfs/util.moon @@ -4,7 +4,7 @@ merge = (orig={}, extra) -> attr[k] = v (elements) -> - import a, div, pre from elements + import a, div, span, pre from elements find_fileder = (fileder, origin) -> if 'string' == type fileder @@ -43,8 +43,9 @@ merge = (orig={}, extra) -> ok, node = pcall fileder.gett, fileder, name, 'mmm/dom' if not ok - return div "couldn't embed #{fileder} #{name}", + return span "couldn't embed #{fileder} #{name}", (pre node), + class: 'embed' style: { background: 'var(--gray-fail)', padding: '1em', @@ -54,7 +55,7 @@ merge = (orig={}, extra) -> klass ..= ' desc' if opts.desc klass ..= ' inline' if opts.inline - node = div { + node = span { class: klass node if opts.desc diff --git a/scss/_content.scss b/scss/_content.scss index 5b6e73b..7aa7b2c 100644 --- a/scss/_content.scss +++ b/scss/_content.scss @@ -11,7 +11,6 @@ .markdown, .markdown > p, - .markdown > p > a, .markdown > a { > img, > video { display: block; @@ -21,6 +20,10 @@ padding: 0 2em; box-sizing: border-box; } + + a, p { + max-width: 100%; + } } .markdown { @@ -38,6 +41,7 @@ } .embed { + display: block; width: inherit; height: inherit; @@ -55,6 +59,10 @@ margin: 0.2em; background: $gray-bright; } + + > *:not(.description) { + max-width: 100%; + } } pre > code { |
