diff options
| author | grothedev <grothedev@gmail.com> | 2025-02-19 00:22:25 -0600 |
|---|---|---|
| committer | grothedev <grothedev@gmail.com> | 2025-02-19 00:22:25 -0600 |
| commit | 006cffddd4910d1b832e3a65e239f7cc20f5f32f (patch) | |
| tree | 5cf5d78c7a0021f3a780d10a4f287ccde4b79371 | |
| parent | 14ee9c84a00bd9ac151efc18b2373c52d75323b1 (diff) | |
fix markup on writing show
| -rw-r--r-- | resources/js/writing_show.js | 13 | ||||
| -rw-r--r-- | resources/views/writings/show.blade.php | 8 |
2 files changed, 10 insertions, 11 deletions
diff --git a/resources/js/writing_show.js b/resources/js/writing_show.js index 86c525a..92487eb 100644 --- a/resources/js/writing_show.js +++ b/resources/js/writing_show.js @@ -1,10 +1,3 @@ -document.addEventListener('DOMContentLoaded', function() { - const content = document.getElementById('content'); - if (content && typeof marked !== 'undefined') { - marked.setOptions({ - breaks: true, - sanitize: true - }); - content.innerHTML = marked.parse(content.textContent); - } -});
\ No newline at end of file +$(function() { + +});
\ No newline at end of file diff --git a/resources/views/writings/show.blade.php b/resources/views/writings/show.blade.php index f8435c9..ee62600 100644 --- a/resources/views/writings/show.blade.php +++ b/resources/views/writings/show.blade.php @@ -1,6 +1,7 @@ @extends('template') @section('head') +<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> @vite(['resources/js/writing_show.js', 'resources/css/writings.css']) @endsection @@ -15,8 +16,13 @@ </header> <div class="writing-content" id="content"> - {{ $writing->content }} + [ loading... ] </div> + <script type = "text/javascript"> + let contentMarkup = {{ Js::from($writing->content) }}; + console.log(contentMarkup); + $('#content')[0].innerHTML = marked.parse(contentMarkup); + </script> @if(Auth::id() === $writing->user_id) <div class="writing-actions"> |
