kotlin-html | Kotlin DSL for HTML and CSS
kandi X-RAY | kotlin-html Summary
kandi X-RAY | kotlin-html Summary
Kotlin DSL for HTML and CSS
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of kotlin-html
kotlin-html Key Features
kotlin-html Examples and Code Snippets
Community Discussions
Trending Discussions on kotlin-html
QUESTION
I am trying to get an image to display on a webpage through the ktor HTML DSL. The image won't appear, and the alt is showing.
I am currently using the IDE Intellij, and I can't think of where to put the image. I tried putting it in the src folder where the .kt file is, but it is still not seeing it.
img (src: "This is a picture!!", alt: "/img/picture.jpg") Here is a source I used: https://github.com/celtric/kotlin-html/blob/master/README.md
The image is supposed to show but the alt shows instead.
...ANSWER
Answered 2019-Jun-04 at 20:21You have to put it in your resources folder.
The src folder is for code to be compiled.
The resources folder should be in src/main/
.
Furthermore, you need to tell ktor to serve static files in your routing.
See the official documentation: https://ktor.io/servers/features/static-content.html
Also, here is an example including the img
tag: https://ktor.io/samples/feature/static.html
Also, take a look at my previous answer for more details regarding static content routing in ktor: https://stackoverflow.com/a/50965188/5335131
QUESTION
I want to use library kotlin-html
to produce html instead of kotlinx.html.
This library produces just a html-text:
ANSWER
Answered 2018-Sep-27 at 20:50You can specify ContentType.Text.Html
for the ContentType
parameter to respondText
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install kotlin-html
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page