You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<pre>
<code class="">
fruits = ["apple", "banana", "cherry"]
for fruit in fruits:
print(fruit)
</code>
</pre>
that I would like converted to a fenced code block via TurndownService::turndown
I initialize the TurndownService with
var turndownService = new TurndowSnService({codeBlockStyle: "fenced"});
However, turndown yields the following string when I pass my element:
"fruits = [\"apple\", \"banana\", \"cherry\"]\n\nfor fruit in fruits:\n print(fruit)"
I've verified by hand that the fencedCodeBlock.filter returns true when passed my element and that fencedCodeBlock.replacement returns the expected string sandwiched by the fence, but this behavior is not reproduced as expected when using TurndownService::turndown
The text was updated successfully, but these errors were encountered:
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
I have a very simple element:
that I would like converted to a fenced code block via
TurndownService::turndown
I initialize the TurndownService with
However, turndown yields the following string when I pass my element:
I've verified by hand that the
fencedCodeBlock.filter
returns true when passed my element and thatfencedCodeBlock.replacement
returns the expected string sandwiched by the fence, but this behavior is not reproduced as expected when usingTurndownService::turndown
The text was updated successfully, but these errors were encountered: