diff --git a/TODO.md b/TODO.md index 089cff7..ddda7b3 100644 --- a/TODO.md +++ b/TODO.md @@ -1,24 +1,13 @@ - [ ] process source code blocks to syntax highlight them - skylighting https://hackage.haskell.org/package/skylighting - More boring therefore more better - - tree sitter https://hackage.haskell.org/package/tree-sitter - - Alternatively do the Rust <-> Haskell binding myself - - https://www.well-typed.com/blog/2023/03/purgatory/ - - https://willmcpherson2.substack.com/p/calling-rust-from-haskell - - https://github.com/BeFunctional/haskell-foreign-rust - - https://github.com/BeFunctional/haskell-rust-ffi - - Borsh - - https://crates.io/crates/tree-sitter-highlight - - Or potentially https://docs.rs/arborium/latest/arborium/ - [ ] Make it so headers render with an anchor with a name to allow linking - [ ] Make a function which takes IR and spits out some kind of table of contents - [ ] swap from using `draft` to using `date` for determing draft status, lack of date = draft - [ ] setup font subsetting (font file minimization) - - `pyftsubset` (`fonttools subset`) is an external tool I can and probably should use - for this -- [ ] Refactor template handling so templates include other templates via lambda rather than implicitly https://hackage-content.haskell.org/package/mustache-2.4.3.1/docs/Text-Mustache.html#v:overText + - `pyftsubset` (`fonttools subset`) is an external tool I can and probably should use for this - [ ] Fix time via timestamps potentially meaning something (via preshim?) and use local offset instead of absolute time https://www.rfc-editor.org/rfc/rfc3339#section-4.2 -- [ ] Add rst or org support and convert markdown handling to custom parser instead of pandoc +- [ ] Add DJOT as an alternate syntax - [ ] Add in functionality for footnotes - There should be a per footnote template as well and also either the default or post template should have an attribute which handles footnotes - [ ] dev server setup (with live reloading) @@ -26,4 +15,4 @@ - https://hackage.haskell.org/package/file-embed - https://hackage.haskell.org/package/fsnotify - [ ] Evaluate using Rolldown -- [ ] see if performance can be improved, it shouldn't be necessary but if I'm looking at doing something for this and everything above this got checked off then this is a sensible next thing +- [ ] see if performance can be improved, it shouldn't be necessary but if I'm looking at doing something for this and everything above this got checked off then this is a sensible next thing diff --git a/psb.cabal b/psb.cabal index e197e6a..eff131a 100644 --- a/psb.cabal +++ b/psb.cabal @@ -29,7 +29,7 @@ library hs-source-dirs: src exposed-modules: Markdown HTML Logger IR Logger.Shake Psb.Main Utilities Utilities.FilePath Utilities.Action Utilities.Javascript Utilities.CSS Templates Types Config Utilities.Bundling other-modules: Utilities.Parsing - build-depends: base >=4.20 && < 4.21, mustache >=2.4.2, shake >= 0.19.8, deriving-aeson >= 0.2.9, aeson, text >= 2.1.2, time, unordered-containers, yaml, megaparsec >= 9.7.0, transformers >= 0.6.2, bytestring + build-depends: base, mustache >=2.4.2, shake >= 0.19.8, deriving-aeson >= 0.2.9, aeson, text >= 2.1.2, time, unordered-containers, yaml, megaparsec >= 9.7.0, transformers >= 0.6.2, bytestring default-extensions: ApplicativeDo DataKinds NamedFieldPuns DerivingVia LambdaCase TypeApplications DeriveGeneric OverloadedRecordDot NamedFieldPuns DuplicateRecordFields DisambiguateRecordFields FlexibleInstances test-suite test-markdown-parse diff --git a/src/HTML.hs b/src/HTML.hs index f253a67..249f846 100644 --- a/src/HTML.hs +++ b/src/HTML.hs @@ -77,5 +77,5 @@ serializeInlineToHTML (Italic elems : remaining) = T.concat ["", serializeInl serializeInlineToHTML (Crossed elems : remaining) = T.concat ["", serializeInlineToHTML elems, "", serializeInlineToHTML remaining] serializeInlineToHTML (InlineCode code : remaining) = T.concat ["", escapeText code, "", serializeInlineToHTML remaining] serializeInlineToHTML (Link {linkText, url, title} : remaining) = T.concat [" T.concat ["title=\"", escapeText t, "\""]) title, ">", serializeInlineToHTML linkText, "", serializeInlineToHTML remaining] -serializeInlineToHTML (Image {altText, url, title} : remaining) = T.concat ["", url, "\" alt=\"", escapeText altText, "\"", maybe "" (\t -> T.concat ["title=\"", escapeText t, "\""]) title, ">", serializeInlineToHTML remaining] +serializeInlineToHTML (Image {altText, url, title} : remaining) = T.concat ["\"", T.concat ["title=\"", escapeText t, "\""]) title, ">", serializeInlineToHTML remaining] serializeInlineToHTML (HTMLInline {inline_html_content} : remaining) = inline_html_content <> serializeInlineToHTML remaining diff --git a/src/Markdown.hs b/src/Markdown.hs index 7702382..7c682a9 100644 --- a/src/Markdown.hs +++ b/src/Markdown.hs @@ -91,11 +91,16 @@ inlineText' disallow = choice [try $ strikethrough disallow, try $ bold disallow pure Link {linkText, url, title} image disallow = do + logDebug "image:before excl" char '!' + logDebug "image:after excl" -- Is this a hack? Yes. Bite me + logDebug "before link" link_hack <- link disallow + logDebug "after link" (altText, url, title) <- case link_hack of Link {linkText = [Text altText], url, title} -> pure (altText, url, title) + Link {linkText = [], url, title} -> pure ("", url, title) _ -> fail "Image alt text must be normal text, cannot be stylized in any way" pure Image {altText, url, title}