Comments (5)
Could you give me an example of how the markdown would look like? If you just want to run the filters already in the markdown file, I don't think you need to even save them as files. I would i) make a list of al the filters in the document, ii) and run eval()
on them, while passing them the document.
from panflute.
Thank you for help.
Markdown code with a chunk would be like:
``` {panflute-name=filter_x}
# standard filter with main()
```
So you mean I should have a meta-filter like this (looks like this would work):
def prepare(doc):
# add to the doc the temporary list
# with found code chunks.
# Now it's empty.
def action(elem, doc):
# if the element is a code chunk
# and has kwarg `panflute-name`
# then add this code chunk to the
# temp list.
def finalize(doc):
# Loop over temp list. On each item:
eval(item)
main(doc)
# Then delete temp list
def main(doc=None):
return run_filter(action, prepare=prepare, finalize=finalize, doc=doc)
from panflute.
I think that will work. I was a bit concerned about eval
ing functions with the same names (prepare, etc.) but since you are evaling within finalize, you could eval()
it with a different namespace (if any issue arises)
from panflute.
from panflute.
Now I think that it's a bad idea :-) Closing.
from panflute.
Related Issues (20)
- Stringifying the terms of a definition list results in AttributeError HOT 7
- Hwo to use the span method? HOT 1
- Applying panflute filter multiple times generates an unexpected result
- Can't convert markdown style citations to LaTeX style using panflute filter HOT 5
- Navigation with next and prev unstable HOT 3
- Add space before footnote in stringify function HOT 4
- Is there solution to add custom style for lists with panflute ? HOT 2
- Avoid side-effects in walk
- Figure, Table: to_json() crashes if caption is None HOT 1
- Reading the value of `--resource-path` inside a panflute filter ? HOT 3
- Trying to create new metadata from metadata
- Removal of click dependency HOT 3
- Installing globally on Ubuntu HOT 2
- Consider different check for RawInline formats?
- version on conda-forge is outdated
- Can panflute support match-case?
- Vertically aligning cells in tables?
- How to make a page break? HOT 1
- Please update to pandoc 3.1.12.2 if possible HOT 3
- Release tags cross wired HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from panflute.