code format

This commit is contained in:
nganhkhoa 2025-01-03 18:19:48 -06:00
parent 224520740b
commit 4efdae3a4f
10 changed files with 434 additions and 294 deletions

View File

@ -1,19 +1,31 @@
module Header exposing (header)
import Html.Styled exposing (..)
import Html.Styled.Attributes exposing (style, target, src, class)
import Route
import Html.Styled.Attributes exposing (class, src, style, target)
import Link exposing (Link)
import Route
header = p [ style "display" "flex", style "flex-direction" "row", style "justify-content" "flex-start" ]
header =
p [ style "display" "flex", style "flex-direction" "row", style "justify-content" "flex-start" ]
[ p [ style "margin-right" "1rem" ] [ home ]
, p [ style "margin-right" "1rem" ] [ blog ]
, p [ style "margin-right" "1rem" ] [ book ]
, p [ style "margin-right" "1rem" ] [ cv ]
]
home = Link.link (Link.internal (Route.Index)) [] [ text "Home" ]
blog = Link.link (Link.internal (Route.Blog__Slug_ { slug = "" })) [] [ text "Blog" ]
book = Link.link (Link.internal (Route.Book)) [] [ text "Book" ]
cv = Link.link (Link.external "/cv.pdf") [ target "_blank" ] [ text "CV" ]
home =
Link.link (Link.internal Route.Index) [] [ text "Home" ]
blog =
Link.link (Link.internal (Route.Blog__Slug_ { slug = "" })) [] [ text "Blog" ]
book =
Link.link (Link.internal Route.Book) [] [ text "Book" ]
cv =
Link.link (Link.external "/cv.pdf") [ target "_blank" ] [ text "CV" ]

View File

@ -7,23 +7,21 @@ import FatalError exposing (FatalError)
import Head
import Head.Seo as Seo
import Html.Styled exposing (..)
import Html.Styled.Attributes exposing (style, class)
import Html.Styled.Attributes exposing (class, style)
import Json.Decode as Decode exposing (Decoder)
import Json.Decode.Extra
import Link
import Markdown.Block
import Markdown.Renderer
import MarkdownCodec
import Pages.Url
import PagesMsg exposing (PagesMsg)
import Route exposing (Route)
import RouteBuilder exposing (App, StatelessRoute)
import Shared
import View exposing (View)
import Link
import Markdown.Block
import Markdown.Renderer
import MarkdownCodec
import TailwindMarkdownRenderer
import Tailwind.Utilities as Tw
import TailwindMarkdownRenderer
import View exposing (View)
type alias Model =
@ -33,9 +31,11 @@ type alias Model =
type alias Msg =
()
type alias RouteParams =
{}
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.single
@ -48,6 +48,7 @@ route =
type alias Data =
List ( Route, Article.ArticleMetadata )
type alias ActionData =
{}
@ -57,6 +58,7 @@ data =
Article.blogAllMetadata
|> BackendTask.allowFatal
head :
App Data ActionData RouteParams
-> List Head.Tag
@ -91,16 +93,19 @@ view app shared =
, text " "
, Link.link (Link.internal (Route.Osx__Slug_ { slug = "" })) [] [ text "series" ]
, text " "
, text "about the Mach-O binary format, used in Apple devices." ]
, text "about the Mach-O binary format, used in Apple devices."
]
, div [] (app.data |> List.map renderBlogItem)
]
]
}
renderBlogItem : ( Route, Article.ArticleMetadata ) -> Html msg
renderBlogItem ( route_, article ) =
div []
[ Link.link (Link.internal route_) [ style "text-decoration" "none" ]
[ Link.link (Link.internal route_)
[ style "text-decoration" "none" ]
[ ul
[]
[ li []
@ -109,5 +114,6 @@ renderBlogItem (route_, article) =
]
]
]
-- , span [ class "marginnote", style "margin-right" "0" ] [ text (Date.toIsoString article.published) ]
]

View File

@ -7,23 +7,21 @@ import FatalError exposing (FatalError)
import Head
import Head.Seo as Seo
import Html.Styled exposing (..)
import Html.Styled.Attributes exposing (style, class)
import Link exposing (Link)
import Html.Styled.Attributes exposing (class, style)
import Json.Decode as Decode exposing (Decoder)
import Json.Decode.Extra
import Link exposing (Link)
import Markdown.Block
import Markdown.Renderer
import MarkdownCodec
import Pages.Url
import PagesMsg exposing (PagesMsg)
import Route
import RouteBuilder exposing (App, StatelessRoute)
import Shared
import View exposing (View)
import Markdown.Block
import Markdown.Renderer
import MarkdownCodec
import TailwindMarkdownRenderer
import Tailwind.Utilities as Tw
import TailwindMarkdownRenderer
import View exposing (View)
type alias Model =
@ -64,6 +62,7 @@ type alias Data =
, body : List Markdown.Block.Block
}
type alias ActionData =
{}
@ -81,6 +80,7 @@ type alias ArticleMetadata =
, subtitle : String
, description : String
, published : Date
-- , image : Pages.Url.Url
, draft : Bool
}
@ -111,6 +111,7 @@ frontmatterDecoder =
|> Decode.map (Maybe.withDefault False)
)
head :
App Data ActionData RouteParams
-> List Head.Tag
@ -136,7 +137,9 @@ view :
-> Shared.Model
-> View (PagesMsg Msg)
view app shared =
let rendered = (app.data.body |> Markdown.Renderer.render TailwindMarkdownRenderer.renderer) |> Result.withDefault []
let
rendered =
(app.data.body |> Markdown.Renderer.render TailwindMarkdownRenderer.renderer) |> Result.withDefault []
in
{ title = app.data.metadata.title
, body =

View File

@ -10,20 +10,18 @@ import Html.Styled exposing (..)
import Html.Styled.Attributes as Attributes
import Json.Decode as Decode exposing (Decoder)
import Json.Decode.Extra
import Link
import Markdown.Block
import Markdown.Renderer
import MarkdownCodec
import Pages.Url
import PagesMsg exposing (PagesMsg)
import Route exposing (Route)
import RouteBuilder exposing (App, StatelessRoute)
import Shared
import View exposing (View)
import Link
import Markdown.Block
import Markdown.Renderer
import MarkdownCodec
import TailwindMarkdownRenderer
import Tailwind.Utilities as Tw
import TailwindMarkdownRenderer
import View exposing (View)
type alias Model =
@ -33,9 +31,11 @@ type alias Model =
type alias Msg =
()
type alias RouteParams =
{}
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.single
@ -48,6 +48,7 @@ route =
type alias Data =
List ( Route, Article.ArticleMetadata )
type alias ActionData =
{}
@ -57,6 +58,7 @@ data =
Article.osxAllMetadata
|> BackendTask.allowFatal
head :
App Data ActionData RouteParams
-> List Head.Tag
@ -218,4 +220,5 @@ view app shared =
}
linkexternal src title = Link.link (Link.external src) [Attributes.target "_blank"] [text title]
linkexternal src title =
Link.link (Link.external src) [ Attributes.target "_blank" ] [ text title ]

View File

@ -5,14 +5,14 @@ import FatalError exposing (FatalError)
import Head
import Head.Seo as Seo
import Html.Styled exposing (..)
import Html.Styled.Attributes exposing (style, target, src, class)
import Html.Styled.Attributes exposing (class, src, style, target)
import Link exposing (Link)
import Pages.Url
import PagesMsg exposing (PagesMsg)
import UrlPath
import Route
import RouteBuilder exposing (App, StatelessRoute)
import Shared
import UrlPath
import View exposing (View)
@ -77,18 +77,19 @@ withSpacing : (List (Html msg) -> Html msg) -> List (Html msg) -> Html msg
withSpacing element =
List.intersperse (text " ") >> element
view :
App Data ActionData RouteParams
-> Shared.Model
-> View (PagesMsg Msg)
view app shared =
{ title = "nganhkhoa"
, body = [ article [ class "paperlike" ]
, body =
[ article [ class "paperlike" ]
[ -- header
h1 [] [ text "Me" ]
, section []
[
p []
[ p []
[ text "I am a Security Engineer. My expertise lies in many parts of binary and program analysis. In the past, I have done works on many technical aspect. I believe that most complex parts of Computer Science can be broken down into bytes and bits."
, span [ class "marginnote" ] [ img [ src "/nganhkhoa.png" ] [] ]
]
@ -96,26 +97,28 @@ view app shared =
[ text "I also enjoy deep research. I have done a few research deeply on memory forensics and binary formats. I write papers about my research, but as an unexperienced researcher, I am still struggling to get them published."
]
, p []
[ text "I currently work at", text " "
[ text "I currently work at"
, text " "
, quicklinks "verichains" "Verichains"
, label [ class "sidenote-number" ] []
, span [ class "sidenote" ] [ text "A security company with renowned reputation." ]
, text ", before that, I was working under", text " "
, text ", before that, I was working under"
, text " "
, quicklinks "bshield" "BShield"
, label [ class "sidenote-number" ] []
, span [ class "sidenote" ] [ text "A mobile protection platform." ]
, text ".", text " "
, text "."
, text " "
, text "BShield is now under Verichains, serving as the product of Verichains. My work including research for both Verichains and BShield, blockchain and mobile security."
]
, p []
[ text "I was an active member of", text " "
[ text "I was an active member of"
, text " "
, quicklinks "efiens" "Efiens"
, label [ class "sidenote-number" ] []
, span [ class "sidenote" ] [ text "CTF team of Ho Chi Minh University of Technology, Vietnam. Our team has won prizes in national and international competitions. Founded 2016, inactive since 2021, superceeded by", text " ", quicklinks "bkisc" "BKISC", text "." ]
, text ".", text " "
, text "."
, text " "
, text "While a member, I actively play CTF under the category Reverse Engineering. I became a leader in the later days of the team, guiding young members into CTF and Computer Security."
]
, p []
@ -137,9 +140,11 @@ view app shared =
, publications
, blabla
]
]]
]
]
}
projects : Html msg
projects =
div []
@ -149,11 +154,15 @@ projects =
[ text "I was a part of the team that helped unveiling the vulnerabilities in many implementations of ECDSA Threshold Signature Scheme protocol by Gennaro and Goldfeder"
, label [ class "sidenote-number" ] []
, span [ class "sidenote" ] [ text "In public key cryptosystem, signing messages usually involves one party with one private key. Threshold Signature Scheme allows more than one party to participate to the signing process while keeping only one private key used. Missing a signing party would be impossible to sign messages. Across the whole process, the private key is kept unknown to all parties. Gennaro and Goldfeder (GG18/GG20) proposed a protocol, which is now superceeded by MPC-CMP." ]
, text ".", text " "
, text "."
, text " "
, text "Our findings was publicly announced and published at two major security conventions,"
, text " ", quicklinks "tsshockblackhat" "Black Hat USA 2023"
, text " ", text "and"
, text " ", quicklinks "tsshockhitb" "Hack In The Box Phuket 2023"
, text " "
, quicklinks "tsshockblackhat" "Black Hat USA 2023"
, text " "
, text "and"
, text " "
, quicklinks "tsshockhitb" "Hack In The Box Phuket 2023"
, label [ class "sidenote-number" ] []
, span [ class "sidenote" ]
[ text "Duy Hieu Nguyen, Anh Khoa Nguyen, Huu Giap Nguyen, Thanh Nguyen and Anh Quynh Nguyen. TSSHOCK: Breaking MPC Wallets and Digital Custodians for $BILLION$ Profit. 2023"
@ -189,7 +198,8 @@ projects =
, span [ class "sidenote" ]
[ text "Pascal Junod and Julien Rinaldini and Johan Wehrli and Julie Michielin. Obfuscator-LLVM -- Software Protection for the Masses. 2015."
]
, text ".", text " "
, text "."
, text " "
, text "With my team, we ported Mixed Boolean-Arithmetic"
, label [ class "sidenote-number" ] []
, span [ class "sidenote" ]
@ -210,18 +220,20 @@ projects =
, span [ class "sidenote" ]
[ text "Joe T. Sylve, Vico Marziale, Golden G. Richard. Pool tag quick scanning for windows memory analysis. 2016."
]
, text ".", text " "
, text "."
, text " "
, text "The work is later improved to search for code injection by my junior in Efiens."
]
]
]
publications : Html msg
publications =
section []
[ h1 [] [ text "Publications" ]
, p [] [
text "Most of my publications are drafts and not reviewed paper. Because I am not in an academic environment so I do not know how to publish."
, p []
[ text "Most of my publications are drafts and not reviewed paper. Because I am not in an academic environment so I do not know how to publish."
]
, withSpacing (p [])
[ text "Simulating Loader for Mach-O Binary Obfuscation and Hooking."
@ -297,6 +309,7 @@ publications =
, text "Advisors: An Khuong Nguyen, Anh Khoa Nguyen."
, br [] []
, text "Year: Expecting 2025"
-- , br [] []
-- , quicklinks "powershellsandbox" "[pdf]"
]
@ -308,11 +321,13 @@ publications =
, text "Advisors: An Khuong Nguyen, Anh Khoa Nguyen."
, br [] []
, text "Year: Expecting 2025"
-- , br [] []
-- , quicklinks "powershellsandbox" "[pdf]"
]
]
blabla : Html msg
blabla =
section []
@ -323,69 +338,140 @@ blabla =
, quicklinks "https://research.ralfj.de/thesis.html" "thesis"
, label [ class "sidenote-number" ] []
, span [ class "sidenote" ] [ text "Jung, Ralf. Understanding and evolving the Rust programming language. 2020." ]
, text ",", text " "
, text ","
, text " "
, text "I amazed how clean the text was due to all the references are introduced at the right side. Later that I found out the format was based on Tufte design and began using it for this website."
]
, p []
[ text "I use Neovim, can't live without those Vim motions. Neovim GUI that I use is"
, text " "
, quicklinks "https://neovide.dev/" "Neovide"
, text ",", text " "
, text ","
, text " "
, text "which I also contributed to add the prompts on Windows right-click menu and copy pasting while on remote connection."
]
, p []
[ text "Linux distribution that I prefer is"
, text " "
, quicklinks "https://artixlinux.org/" "Artix Linux"
, text ".", text " "
, text "I enjoy when everything is barebone and at the edge, most setup are mine and I can figure out things faster when I am the one doing the setup. I choose Artix over the vanila Arch Linux because does there is no systemd." ]
, text "."
, text " "
, text "I enjoy when everything is barebone and at the edge, most setup are mine and I can figure out things faster when I am the one doing the setup. I choose Artix over the vanila Arch Linux because does there is no systemd."
]
, p []
[ text "You might not see me active on Github, because I have my own Git server storing my projects (personal and job). I also run my own VPN server through Wireguard. I just like doing many things by myself."
]
]
quicklinks link title =
let
linkexternal src = Link.link (Link.external src) [target "_blank"] [text title]
linkinternal src = case src of
"blog" -> Link.link (Link.internal (Route.Blog__Slug_ { slug = "" })) [] [ text title ]
"osx" -> Link.link (Link.internal (Route.Osx__Slug_ { slug = "" })) [] [ text title ]
"book" -> Link.link (Link.internal Route.Book) [] [ text title ]
_ -> Link.link (Link.external "") [] [text title]
linkexternal src =
Link.link (Link.external src) [ target "_blank" ] [ text title ]
linkinternal src =
case src of
"blog" ->
Link.link (Link.internal (Route.Blog__Slug_ { slug = "" })) [] [ text title ]
"osx" ->
Link.link (Link.internal (Route.Osx__Slug_ { slug = "" })) [] [ text title ]
"book" ->
Link.link (Link.internal Route.Book) [] [ text title ]
_ ->
Link.link (Link.external "") [] [ text title ]
in
case link of
"github" -> linkexternal "https://github.com/nganhkhoa"
"git" -> linkexternal "https://git.nganhkhoa.com"
"efiens" -> linkexternal "https://blog.efiens.com/author/luibo"
"bshield" -> linkexternal "https://bshield.io"
"verichains" -> linkexternal "https://verichains.io"
"bkisc" -> linkexternal "https://bkisc.com/"
"elm" -> linkexternal "https://elm-pages.com"
-- tsshock
"gg" -> linkexternal "https://eprint.iacr.org/2019/114"
"tsshockblackhat" -> linkexternal "https://www.blackhat.com/us-23/briefings/schedule/#tsshock-breaking-mpc-wallets-and-digital-custodians-for-billion-profit-33343"
"tsshockhitb" -> linkexternal "https://conference.hitb.org/hitbsecconf2023hkt/session/tsshock-breaking-mpc-wallets-and-digital-custodians/"
"tsshockwebsite" -> linkexternal "https://verichains.io/tsshock"
"tsshockwhitepaper" -> linkexternal "https://www.verichains.io/tsshock/verichains-tsshock-wp-v1.0.pdf"
"tsshockvideohitb" -> linkexternal "https://youtu.be/1ks2jcS7UE4"
"tsshockvideoblackhat" -> linkexternal "https://youtu.be/5mlQb8PEF3A"
-- ollvm
"ollvm" -> linkexternal "https://doi.org/10.1109/SPRO.2015.10"
"mba" -> linkexternal "https://doi.org/10.1007/978-3-540-77535-5_5"
"tetctf2022" -> linkexternal "https://twitter.com/hgarrereyn/status/1477919411977830402"
-- memory forensics
"poolscan" -> linkexternal "https://doi.org/10.1016/j.diin.2016.01.005"
-- site resources
"cv" -> linkexternal "/cv.pdf"
"blog" -> linkinternal "blog"
"osx" -> linkinternal "osx"
"book" -> linkinternal "book"
-- pdfs
"memorypoolscan" -> linkexternal "https://drive.google.com/file/d/1Z_cKtBsi_gm8ugsrnAEPo-Wmx9GAuaSK/view?usp=sharing"
"memoryinjection" -> linkexternal "https://drive.google.com/file/d/1X18tr4OvcNYRoyxzTcsxM_MgjcqVW1sk/view?usp=sharing"
"powershellsandbox" -> linkexternal "https://drive.google.com/file/d/1Fm1YVAxD-A-zjVvRwBPa-IhZ1Y8ImEyv/view?usp=sharing"
"macho" -> linkexternal "/papers/macho-obfuscation.pdf"
"macho-git" -> linkexternal "https://git.nganhkhoa.com/dot/macho"
"live-memory-forensics" -> linkexternal "/papers/live-memory-forensics.pdf"
_ -> linkexternal link
"github" ->
linkexternal "https://github.com/nganhkhoa"
"git" ->
linkexternal "https://git.nganhkhoa.com"
"efiens" ->
linkexternal "https://blog.efiens.com/author/luibo"
"bshield" ->
linkexternal "https://bshield.io"
"verichains" ->
linkexternal "https://verichains.io"
"bkisc" ->
linkexternal "https://bkisc.com/"
"elm" ->
linkexternal "https://elm-pages.com"
-- tsshock
"gg" ->
linkexternal "https://eprint.iacr.org/2019/114"
"tsshockblackhat" ->
linkexternal "https://www.blackhat.com/us-23/briefings/schedule/#tsshock-breaking-mpc-wallets-and-digital-custodians-for-billion-profit-33343"
"tsshockhitb" ->
linkexternal "https://conference.hitb.org/hitbsecconf2023hkt/session/tsshock-breaking-mpc-wallets-and-digital-custodians/"
"tsshockwebsite" ->
linkexternal "https://verichains.io/tsshock"
"tsshockwhitepaper" ->
linkexternal "https://www.verichains.io/tsshock/verichains-tsshock-wp-v1.0.pdf"
"tsshockvideohitb" ->
linkexternal "https://youtu.be/1ks2jcS7UE4"
"tsshockvideoblackhat" ->
linkexternal "https://youtu.be/5mlQb8PEF3A"
-- ollvm
"ollvm" ->
linkexternal "https://doi.org/10.1109/SPRO.2015.10"
"mba" ->
linkexternal "https://doi.org/10.1007/978-3-540-77535-5_5"
"tetctf2022" ->
linkexternal "https://twitter.com/hgarrereyn/status/1477919411977830402"
-- memory forensics
"poolscan" ->
linkexternal "https://doi.org/10.1016/j.diin.2016.01.005"
-- site resources
"cv" ->
linkexternal "/cv.pdf"
"blog" ->
linkinternal "blog"
"osx" ->
linkinternal "osx"
"book" ->
linkinternal "book"
-- pdfs
"memorypoolscan" ->
linkexternal "https://drive.google.com/file/d/1Z_cKtBsi_gm8ugsrnAEPo-Wmx9GAuaSK/view?usp=sharing"
"memoryinjection" ->
linkexternal "https://drive.google.com/file/d/1X18tr4OvcNYRoyxzTcsxM_MgjcqVW1sk/view?usp=sharing"
"powershellsandbox" ->
linkexternal "https://drive.google.com/file/d/1Fm1YVAxD-A-zjVvRwBPa-IhZ1Y8ImEyv/view?usp=sharing"
"macho" ->
linkexternal "/papers/macho-obfuscation.pdf"
"macho-git" ->
linkexternal "https://git.nganhkhoa.com/dot/macho"
"live-memory-forensics" ->
linkexternal "/papers/live-memory-forensics.pdf"
_ ->
linkexternal link

View File

@ -10,20 +10,18 @@ import Html.Styled exposing (..)
import Html.Styled.Attributes as Attributes
import Json.Decode as Decode exposing (Decoder)
import Json.Decode.Extra
import Link
import Markdown.Block
import Markdown.Renderer
import MarkdownCodec
import Pages.Url
import PagesMsg exposing (PagesMsg)
import Route exposing (Route)
import RouteBuilder exposing (App, StatelessRoute)
import Shared
import View exposing (View)
import Link
import Markdown.Block
import Markdown.Renderer
import MarkdownCodec
import TailwindMarkdownRenderer
import Tailwind.Utilities as Tw
import TailwindMarkdownRenderer
import View exposing (View)
type alias Model =
@ -33,9 +31,11 @@ type alias Model =
type alias Msg =
()
type alias RouteParams =
{}
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.single
@ -48,6 +48,7 @@ route =
type alias Data =
List ( Route, Article.ArticleMetadata )
type alias ActionData =
{}
@ -57,6 +58,7 @@ data =
Article.osxAllMetadata
|> BackendTask.allowFatal
head :
App Data ActionData RouteParams
-> List Head.Tag
@ -100,14 +102,16 @@ view app shared =
]
}
oldBlogs : List (Html msg)
oldBlogs =
[ (Link.link (Link.internal (Route.Osx__Slug_ { slug = "macho" })) [] [text "Macho"] )
, (Link.link (Link.internal (Route.Osx__Slug_ { slug = "linker" })) [] [text "Linker"] )
, (Link.link (Link.internal (Route.Osx__Slug_ { slug = "fairplay" })) [] [text "Fairplay"] )
, (Link.link (Link.internal (Route.Osx__Slug_ { slug = "injection" })) [] [text "Injection"] )
[ Link.link (Link.internal (Route.Osx__Slug_ { slug = "macho" })) [] [ text "Macho" ]
, Link.link (Link.internal (Route.Osx__Slug_ { slug = "linker" })) [] [ text "Linker" ]
, Link.link (Link.internal (Route.Osx__Slug_ { slug = "fairplay" })) [] [ text "Fairplay" ]
, Link.link (Link.internal (Route.Osx__Slug_ { slug = "injection" })) [] [ text "Injection" ]
]
whitepaper : String
whitepaper = "/papers/macho-obfuscation.pdf"
whitepaper : String
whitepaper =
"/papers/macho-obfuscation.pdf"

View File

@ -7,23 +7,21 @@ import FatalError exposing (FatalError)
import Head
import Head.Seo as Seo
import Html.Styled exposing (..)
import Html.Styled.Attributes exposing (style, class)
import Link exposing (Link)
import Html.Styled.Attributes exposing (class, style)
import Json.Decode as Decode exposing (Decoder)
import Json.Decode.Extra
import Pages.Url
import PagesMsg exposing (PagesMsg)
import RouteBuilder exposing (App, StatelessRoute)
import Route
import Shared
import View exposing (View)
import Link exposing (Link)
import Markdown.Block
import Markdown.Renderer
import MarkdownCodec
import TailwindMarkdownRenderer
import Pages.Url
import PagesMsg exposing (PagesMsg)
import Route
import RouteBuilder exposing (App, StatelessRoute)
import Shared
import Tailwind.Utilities as Tw
import TailwindMarkdownRenderer
import View exposing (View)
type alias Model =
@ -64,6 +62,7 @@ type alias Data =
, body : List Markdown.Block.Block
}
type alias ActionData =
{}
@ -81,6 +80,7 @@ type alias ArticleMetadata =
, subtitle : String
, description : String
, published : Date
-- , image : Pages.Url.Url
, draft : Bool
}
@ -111,6 +111,7 @@ frontmatterDecoder =
|> Decode.map (Maybe.withDefault False)
)
head :
App Data ActionData RouteParams
-> List Head.Tag
@ -136,7 +137,9 @@ view :
-> Shared.Model
-> View (PagesMsg Msg)
view app shared =
let rendered = (app.data.body |> Markdown.Renderer.render TailwindMarkdownRenderer.renderer) |> Result.withDefault []
let
rendered =
(app.data.body |> Markdown.Renderer.render TailwindMarkdownRenderer.renderer) |> Result.withDefault []
in
{ title = app.data.metadata.title
, body =

View File

@ -3,18 +3,18 @@ module Shared exposing (Data, Model, Msg(..), SharedMsg(..), template)
import BackendTask exposing (BackendTask)
import Effect exposing (Effect)
import FatalError exposing (FatalError)
import Header exposing (header)
import Html exposing (Html)
import Html.Styled
import Html.Styled.Events
import Link exposing (Link)
import Pages.Flags
import Pages.PageUrl exposing (PageUrl)
import UrlPath exposing (UrlPath)
import Route exposing (Route)
import SharedTemplate exposing (SharedTemplate)
import UrlPath exposing (UrlPath)
import View exposing (View)
import Header exposing (header)
import Link exposing (Link)
template : SharedTemplate Msg Model Data msg
template =
@ -96,9 +96,9 @@ view :
-> { body : List (Html msg), title : String }
view tableOfContents page model toMsg pageView =
{ body =
[
header
[ header
|> Html.Styled.toUnstyled
-- ((View.Header.view ToggleMobileMenu 123 page.path
-- |> Html.Styled.map toMsg
-- )
@ -110,6 +110,9 @@ view tableOfContents page model toMsg pageView =
]
, title = pageView.title
}
-- view sharedData page model toMsg pageView =
-- { body =
-- [ Html.Styled.nav []
@ -118,7 +121,6 @@ view tableOfContents page model toMsg pageView =
-- [ Html.Styled.text
-- (if model.showMenu then
-- "Close Menu"
-- else
-- "Open Menu"
-- )
@ -128,7 +130,6 @@ view tableOfContents page model toMsg pageView =
-- [ Html.Styled.li [] [ Html.Styled.text "Menu item 1" ]
-- , Html.Styled.li [] [ Html.Styled.text "Menu item 2" ]
-- ]
-- else
-- Html.Styled.text ""
-- ]

View File

@ -16,6 +16,7 @@ config =
head : BackendTask FatalError (List Head.Tag)
head =
[ Head.metaName "viewport" (Head.raw "width=device-width,initial-scale=1")
-- , Head.nonLoadingNode "link"
-- [ ( "rel", Head.raw "stylesheet" )
-- , ( "crossorigin", Head.raw "anonymous" )

View File

@ -1,14 +1,18 @@
module Article exposing (..)
-- import Cloudinary
import BackendTask
import BackendTask.File as File
import BackendTask.Glob as Glob
-- import Cloudinary
import Date exposing (Date)
import FatalError exposing (FatalError)
import Json.Decode as Decode exposing (Decoder)
import Pages.Url exposing (Url)
import Route
-- import UnsplashImage
@ -27,15 +31,23 @@ contentPostsGlob folder =
|> Glob.match (Glob.literal ".md")
|> Glob.toBackendTask
blogPostsGlob = contentPostsGlob "blog/"
osxPostsGlob = contentPostsGlob "osx/"
blogPostsGlob =
contentPostsGlob "blog/"
osxPostsGlob =
contentPostsGlob "osx/"
allMetadata :
(String -> Route.Route)
-> BackendTask.BackendTask
->
BackendTask.BackendTask
{ fatal : FatalError, recoverable : File.FileReadError Decode.Error }
(List BlogPost)
-> BackendTask.BackendTask
->
BackendTask.BackendTask
-- error
{ fatal : FatalError, recoverable : File.FileReadError Decode.Error }
(List ( Route.Route, ArticleMetadata ))
@ -47,7 +59,7 @@ allMetadata routeBuilder posts =
|> List.map
(\{ filePath, slug } ->
BackendTask.map2 Tuple.pair
(BackendTask.succeed <| (routeBuilder slug))
(BackendTask.succeed <| routeBuilder slug)
(File.onlyFrontmatter frontmatterDecoder filePath)
)
)
@ -59,6 +71,7 @@ allMetadata routeBuilder posts =
(\( route, metadata ) ->
if metadata.draft then
Nothing
else
Just ( route, metadata )
)
@ -68,14 +81,21 @@ allMetadata routeBuilder posts =
(\( route, metadata ) -> -(Date.toRataDie metadata.published))
)
blogAllMetadata = allMetadata (\s -> Route.Blog__Slug_ { slug = s }) blogPostsGlob
osxAllMetadata = allMetadata (\s -> Route.Osx__Slug_ { slug = s }) osxPostsGlob
blogAllMetadata =
allMetadata (\s -> Route.Blog__Slug_ { slug = s }) blogPostsGlob
osxAllMetadata =
allMetadata (\s -> Route.Osx__Slug_ { slug = s }) osxPostsGlob
type alias ArticleMetadata =
{ title : String
, subtitle : String
, summary : String
, published : Date
-- , image : Url
, draft : Bool
}
@ -111,6 +131,7 @@ frontmatterDecoder =
)
-- imageDecoder : Decoder Url
-- imageDecoder =
-- Decode.string