Comments (3)
This looks like it's working on the live demo: https://mixmark-io.github.io/turndown/
The output is:
``` fruits = ["apple", "banana", "cherry"] for fruit in fruits: print(fruit) ```
from turndown.
Looks like this happens only when I pass the HTML element directly, whereas if I instead do
turndownService.turndown(element.outerHTML)
the element is converted as I expected. Is this intended behavior?
FWIW, I see that when I pass the element directly, the thing that makes it to fencedCodeBlock.filter
is a node with "<pre>...</pre>" stripped away, ie a code node, which fails the filter criteria
from turndown.
The codeBlockStyle
option will do this for you. For example:
var turndownService = new TurndownService({ codeBlockStyle: 'fenced' })
turndownService.turndown('<pre><code class="language-js">console.log("hello world")</code></pre>')
from turndown.
Related Issues (20)
- Line break in formatting not respected HOT 3
- Strong delimiter rendered on a newline in certain situations
- error while running with webpack bundle in nodejs HOT 7
- Emphasis doesn't work within a word with `_`
- closed and immediately re-opened emphasis breaks markdown parsers
- Reverse converting HOT 1
- Is there a way to have a bullet for each level of indentation in nested lists?
- Option to configure the type of quotation marks used.
- HTML nested lists are not formatted correctly in Markdown HOT 3
- Should delete styles
- Why are non-breaking spaces returned when regular spaces are given? HOT 3
- getting torchlight.dev generated code in side codeblock. want only backtick version of code #288 HOT 1
- Keep tags on link as HTML HOT 1
- keep() and remove() does not work for all HTML tags HOT 1
- Usage With Browser & Node HOT 3
- turndown not escaping links properly HOT 4
- Create avatar for Mixmark GitHub organization HOT 2
- Can we use this library to read the contents from an HTML file instead of passing the HTML content as text input? Please advise. HOT 2
- Please clarify how to run this code with a complete example 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 turndown.