add citation in markdown

This commit is contained in:
nganhkhoa 2025-01-03 18:19:31 -06:00
parent f50fe9f7fc
commit 224520740b
2 changed files with 19 additions and 1 deletions

View File

@ -17,3 +17,13 @@ npm start
## Why elm?
¯\_(ツ)_/¯
Writing web application with types. Although it would make you go insane rather than make the job done for you.
## Citing in Markdown
Use HTML tag `<cite>` with attribute `ref` as the content of the citation.
```md
Some paper<cite ref="name of paper, authors, conference and journal"/>
```

View File

@ -3,7 +3,7 @@ module TailwindMarkdownRenderer exposing (renderer)
import Css
import Ellie
import Html.Styled as Html
import Html.Styled.Attributes as Attr exposing (css)
import Html.Styled.Attributes as Attr exposing (css, class)
import Markdown.Block as Block
import Markdown.Html
import Markdown.Renderer
@ -116,6 +116,14 @@ renderer =
Ellie.outputTabElmCss ellieId
)
|> Markdown.Html.withAttribute "id"
, Markdown.Html.tag "cite"
(\ref _ ->
Html.span []
[ Html.label [ class "sidenote-number" ] []
, Html.span [ class "sidenote" ] [ Html.text ref ]
]
)
|> Markdown.Html.withAttribute "ref"
]
, codeBlock = codeBlock