todo stuff and fixing images
This commit is contained in:
parent
1e5911b68f
commit
c90d2e45b8
4 changed files with 10 additions and 16 deletions
15
TODO.md
15
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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -77,5 +77,5 @@ serializeInlineToHTML (Italic elems : remaining) = T.concat ["<i>", serializeInl
|
|||
serializeInlineToHTML (Crossed elems : remaining) = T.concat ["<s>", serializeInlineToHTML elems, "</s>", serializeInlineToHTML remaining]
|
||||
serializeInlineToHTML (InlineCode code : remaining) = T.concat ["<code>", escapeText code, "</code>", serializeInlineToHTML remaining]
|
||||
serializeInlineToHTML (Link {linkText, url, title} : remaining) = T.concat ["<a href=\"", url, "\"", maybe "" (\t -> T.concat ["title=\"", escapeText t, "\""]) title, ">", serializeInlineToHTML linkText, "</a>", serializeInlineToHTML remaining]
|
||||
serializeInlineToHTML (Image {altText, url, title} : remaining) = T.concat ["<img src=\">", url, "\" alt=\"", escapeText altText, "\"", maybe "" (\t -> T.concat ["title=\"", escapeText t, "\""]) title, ">", serializeInlineToHTML remaining]
|
||||
serializeInlineToHTML (Image {altText, url, title} : remaining) = T.concat ["<img src=\"", url, "\" alt=\"", escapeText altText, "\"", maybe "" (\t -> T.concat ["title=\"", escapeText t, "\""]) title, ">", serializeInlineToHTML remaining]
|
||||
serializeInlineToHTML (HTMLInline {inline_html_content} : remaining) = inline_html_content <> serializeInlineToHTML remaining
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue