投稿時間:2022-09-04 02:14:30 RSSフィード2022-09-04 02:00 分まとめ(16件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
js JavaScriptタグが付けられた新着投稿 - Qiita Javascript 変数・定数について https://qiita.com/s_takanori/items/6d9a27ea4431c3850391 javascript 2022-09-04 01:27:42
js JavaScriptタグが付けられた新着投稿 - Qiita Javascript いろいろなconsole https://qiita.com/s_takanori/items/48fbda5028333ce985fb consoleerro 2022-09-04 01:12:55
Docker dockerタグが付けられた新着投稿 - Qiita VS Remote-Containers を使用した簡単な Astro 環境 https://qiita.com/dabiddo/items/cbcece76804a827ee4e8 astro 2022-09-04 01:53:37
Docker dockerタグが付けられた新着投稿 - Qiita DockerでコンテナのCreatingが終わらないときはFile sharingを確認する https://qiita.com/nouka/items/afb797ad7a83689327e2 dockerf 2022-09-04 01:24:19
海外TECH MakeUseOf 7 Mobile Apps to Help You Eat Healthier by Reducing Meat in Your Diet https://www.makeuseof.com/mobile-apps-eat-healthier-reducing-meat-diet/ Mobile Apps to Help You Eat Healthier by Reducing Meat in Your DietEven without going fully vegetarian you can start eating healthier and helping the environment by cutting back on meat in your diet 2022-09-03 16:01:13
海外TECH DEV Community Render Markdown from a string in Svelte (mdsvex / SvelteKit) https://dev.to/willkre/render-markdown-from-a-string-in-svelte-mdsvex-sveltekit-1597 Render Markdown from a string in Svelte mdsvex SvelteKit The Svelte Markdown tutorials I ve seen out there assume that you have access to a md file or are writing Markdown directly in a preprocessed file What if you wanted to render a raw string that contains Markdown Example use case You want the flexibility of being able to serve Markdown content from a CMS such as Strapi without having to make changes to a md file There are a few ways you can achieve this in this solution we ll be using mdsvex to convert the Markdown into HTML format then rendering that HTML mdsvex is a Markdown preprocessor which is essentially a wrapper for MDX making it compatible for Svelte InstallationIf you re not using SvelteKit check out the MDsveX docs for alternative installations if you are Start by installing it as a dev dependency npm i save dev mdsvexor yarn add dev mdsvexThen update the Svelte configuration to include an extensions array We ll just be using a svelte file but you can also include extensions such as svx if you plan on using those file types svelte config jsexport default preprocess your existing config extensions svelte Add this kit your existing config That s all the configuration we need for now ️Passing the compiled string to the componentLet s set up a route loader that simulates fetching data from an API page server tsimport type Load from sveltejs kit const MOCK RESPONSE FROM API LoremLorem is currently extended with the following plugins Instructions on how to use them in your application are linked below Plugin README Dropbox plugins dropbox README md Link Medium plugins medium README md Link Google Analytics plugins googleanalytics README md Link export const load Load async gt const response MOCK RESPONSE FROM API Get data with eg fetch return response Next we can import the compile function from mdsvex declare a variable passing the mock response into it and return it so it s available in our component We ll also log it to see what gets returned from compile page server tsimport compile from mdsvex const compiledResponse await compile response console log compiledResponse is compiledResponse return compiledResponse console output Given this is being run server side it s viewable on the terminal not the browser console As you can see the Markdown has been compiled into what looks like HTML string format appended together with the operator under the key of code So we can update the return statement to only include what we need page server tsexport const load Load async gt const res MOCK RESPONSE FROM API Get data with eg fetch const compiledResponse await compile res return content compiledResponse code Rendering the HTML directly into the componentNow from our component all we need to do is receive the data through export let and render it Usually strings are inserted as plain text meaning that characters like lt and gt have no special meaning So given we ve now got HTML that we want to render directly we can use HTML tags lt p gt html string lt p gt so in our case page svelte lt script lang ts gt export let data content lt script gt lt div gt html data content lt div gt Which gives us our rendered Markdown 🪄 Note from the docs Svelte does not sanitise expressions before injecting HTML If the data comes from an untrusted source you must sanitise it or you are exposing your users to an XSS vulnerability Further CustomisationThe compile method accepts a second parameter options interface MdsvexOptions extensions string smartypants boolean smartypantsOptions layout string name string string remarkPlugins Array lt plugin gt Array lt plugin plugin options gt rehypePlugins Array lt plugin gt Array lt plugin plugin options gt highlight highlighter Function alias alias lang frontmatter parse Function marker string This means that you can transform your HTML with tools like rehype or remark You can find out more about the available options here That s it ‍If you need any further information on the above or anything else related check out the SvelteKit docs the MDX docs or the official Svelte discord 2022-09-03 16:08:49
海外TECH CodeProject Latest Articles A Primer on GCP Compute Instance VMs for Dockerized Apps [Tutorial Part 8] https://www.codeproject.com/Articles/5341262/A-Primer-on-GCP-Compute-Instance-VMs-for-Dockerize manager 2022-09-03 16:16:00
海外科学 NYT > Science NASA’s Artemis I Launch to the Moon Scrubbed Again https://www.nytimes.com/2022/09/03/science/nasa-artemis-rocket-launch-delay.html flight 2022-09-03 16:18:56
海外TECH WIRED The 35 Best Labor Day Deals on Tech, Grills, and Home Goods https://www.wired.com/story/best-labor-day-sales-2022/ robot 2022-09-03 16:43:00
海外科学 BBC News - Science & Environment Nasa: Artemis Moon rocket second launch attempt called off https://www.bbc.co.uk/news/science-environment-62758482?at_medium=RSS&at_campaign=KARANGA hydrogen 2022-09-03 16:42:33
ニュース BBC News - Home Nasa: Artemis Moon rocket second launch attempt called off https://www.bbc.co.uk/news/science-environment-62758482?at_medium=RSS&at_campaign=KARANGA hydrogen 2022-09-03 16:42:33
ニュース BBC News - Home The Hundred: Oval Invincibles beat Southern Brave to win second title https://www.bbc.co.uk/sport/cricket/62780640?at_medium=RSS&at_campaign=KARANGA brave 2022-09-03 16:45:31
ニュース BBC News - Home England 52-14 United States: England win record 24th Test in a row https://www.bbc.co.uk/sport/rugby-union/62780663?at_medium=RSS&at_campaign=KARANGA world 2022-09-03 16:29:56
ニュース BBC News - Home Chelsea 2-1 West Ham United: Blues come from behind to win https://www.bbc.co.uk/sport/football/62701648?at_medium=RSS&at_campaign=KARANGA bridge 2022-09-03 16:46:03
ニュース BBC News - Home Brentford 5-2 Leeds United: Ivan Toney passes 50 goals for Bees with stunning hat-trick https://www.bbc.co.uk/sport/football/62697699?at_medium=RSS&at_campaign=KARANGA Brentford Leeds United Ivan Toney passes goals for Bees with stunning hat trickIvan Toney scores a hat trick as Brentford rise to seventh in the Premier League with an entertaining win over Leeds United 2022-09-03 16:52:49
北海道 北海道新聞 アニメ「邪神ちゃん」の魅力語る 帯広競馬場で声優3人がトークショー https://www.hokkaido-np.co.jp/article/725958/ 北海道文化放送 2022-09-04 01:16:08

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)