kiranshila / cybermonday Goto Github PK
View Code? Open in Web Editor NEWMarkdown as Clojure Data
License: Eclipse Public License 1.0
Markdown as Clojure Data
License: Eclipse Public License 1.0
I am interested in making programmatic changes to markdown templates, writing the modified markdown back to a file. I don't see a function for exporting back to markdown (only HTML), so I am wondering if I've missed something, or how one might accomplish such a thing.
Can I do a round trip from my AST representation back to the original Markdown instead of HTML?
Finish getting the flexmark attributes deal working
The idea was to merge children attribute notes into the attributes map of the parent, but not every parent has attributes. This may need to be a design change such that all AST nodes include an least an empty map such that potential children attribute nodes can merge in their contents.
Hey! Thanks for this package. It's made my life easy.
I'm getting an IllegalStateException from within the library.
Execution error (IllegalStateException) at cybermonday.ir/fold-inline-html$fn (ir.cljc:55).
Can't pop empty vector
I am unsure how to proceed with troubleshooting or what might be causing this inconsistent state.
Code's here:
cybermonday/src/cybermonday/ir.cljc
Line 55 in 8b94aef
(parse-md)
on that file string.The offending text in the file is <span class="spurious-link"target="matrix.org">*matrix.org*</span>
; this may be a problem with other HTML in markdown contexts as well.
Here's my entire context if you're interested: https://github.com/jakeisnt/site/blob/9aa28a968f0f1cd5e8ca8567852cb7d0479c96ca/src/main.clj
Simple example of <foo bar="baz"></foo>
works in the JVM
{:frontmatter nil,
:body
[:div {}
[:p {}
[:foo {:bar "baz"}]]]}
but crashes JS.
don't work
Hi there! I'm a big fan of Cybermonday, I'm using it in a static site generator I'm working on.
I'm wondering if you'd be open to including support for the Table of Contents Flexmark Extension. Basically you just add a line of [TOC]
or [TOC levels=1-3]
and you get a table of contents which is just a tree of nested ul
elements with links to the heading anchors.
I got excited and actually implemented this today, and from what I can tell it works great! Are you interested in adding this extension/feature? I know you want to keep some parity with the CLJS side. I don't have any code for that atm.
The library explicitly includes shadow-cljs as a library dependency, which leads to a lot of unnecessary dependencies being exported to consuming applications.
Build time deps should as these should ideally not be exposed to consuming apps.
Relatedly the flexmark-test-util
dependency pulls in junit
which is another such dep.
These deps are introducing libraries to classpaths which have known CVE's against them. In almost all cases these CVEs will not be used or exploitable; they do however cause false positives which need to be handled by automated tools such as nvd-clojure.
This is a feature request rather than a true issue so please feel free to ignore it -- I am using Mustache style markers in my Markdown such as {{name}} to be replaced with Tom - If the {{ }} could be separated out as nodes it would make them easier to process -- I could do this outside of Cybermonday but I was thinking it may not be very difficult and it may be that flexmark already can handle this (I am using Clojure not Clojurescript). I thought I'd ask .
Here is an example from my application (the example has an {{#if }} {{/if }} construct that may not be standard mustache):
[:p
{}
"FOR VALUE RECEIVED, the undersigned, {{maker}}, {{#if individual}}an individual residing{{else}}a company registered{{/if}} at {{makerAddress}} (“Maker”), hereby promises to pay to the order of {{lender}}, a {{legalEntity}}, having offices at {{lenderAddress}}, or its successors and permitted assigns (“Lender” or the “Company”), the principal sum of {{principal as "0,0.00 CCC"}}, plus any and all interest accrued thereon at the Note Rate (defined below), each due and payable in cash in lawful money of the United States on the dates and in the manner set forth in this Promissory Note (this “Note”)."]
This comes from the hickory dependency, which seems abandoned.
There is an unmerged PR which appears to fix it here: clj-commons/hickory#62
However it seems it's unlikely to get merged. In the short term I'd suggest adding a dep on jsoup to cybermonday that bumps to the version in that PR; and we can over the medium/longer term look at forking hickory and ensuring it is adequately maintained (I've skimmed some of the forks and non look like good long term bets).
Is hickory just used for cybermonday on the JVM side of things, or clojurescript too?
cybermonday.core> (md-to-ir "[hobbit-hole][1]\n\n[1]:#link")
[:div
{}
[:p
{}
[:cybermonday.ir/link-ref
{:reference
[:cybermonday.ir/reference {:title nil, :label "1", :href "#link"}]}
"hobbit-hole"]]
[:cybermonday.ir/reference {:title nil, :label "1", :href "#link"}]]
cybermonday.core> (md-to-ir "[hobbit-hole] [1]\n\n[1]:#link")
[:div
{}
[:p
{}
[:cybermonday.ir/link-ref {:reference nil} "hobbit-hole"]
nil
[:cybermonday.ir/link-ref
{:reference
[:cybermonday.ir/reference {:title nil, :label "1", :href "#link"}]}
"1"]]
[:cybermonday.ir/reference {:title nil, :label "1", :href "#link"}]]
cybermonday.core>
Right now, the templating is very naive, allowing for tagging the most basic mustache-style syntax of {{foo}}
I really like the mustache spec and would like to support more of the features. I need to work out how to interleave that into the parsing, for example not templating in preformatted-contexts like code blocks.
Any suggestions on useful behavior, please let me know.
Just a note that the upstream library io.forward/yaml
and consequently this library which depends on it, are flagged by nvd as being potentially vulnerable to the above CVE-2017-18640.
The library's master branch bumps its snakeyaml dependency to a more recent version which fixes the issue, however no release has been coined upstream.
I have opened an issue upstream here asking if they can create a new non-snapshot release: owainlewis/yaml#40
Though NOTE also the latest commit on their master branch also changes their maven group name.
In the mean time I suspect it is possible to include the snakeyaml dep here at a more recent version.
kiranshila, thanks for the great library.
Triple dash is for front matter, and that works great in most documents. But in the case that the document itself has 3 dashes in it as a part of the content, parsing breaks entirely.
Currently broken
* [A link](#target)
just creates
[::ir/list-item "[A link](#target)"]
Instead of
[::ir/list-item [:p [::ir/link {:href "#target"} "A link"]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.