Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle nodejs executable on debian #5202

Merged
merged 1 commit into from
Feb 23, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 12 additions & 3 deletions IPython/nbconvert/filters/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def markdown2html_pandoc(source):

def markdown2html_marked(source, encoding='utf-8'):
"""Convert a markdown string to HTML via marked"""
command = ['node', marked]
command = [node_cmd, marked]
try:
p = subprocess.Popen(command,
stdin=subprocess.PIPE, stdout=subprocess.PIPE
Expand Down Expand Up @@ -99,9 +99,18 @@ def markdown2rst(source):
"""
return pandoc(source, 'markdown', 'rst')

# prefer md2html via marked if node.js is available
# node is called nodejs on debian, so try that first
node_cmd = 'nodejs'
try:
find_cmd('node')
find_cmd(node_cmd)
except FindCmdError:
markdown2html = markdown2html_pandoc
node_cmd = 'node'
try:
find_cmd(node_cmd)
except FindCmdError:
markdown2html = markdown2html_pandoc
else:
markdown2html = markdown2html_marked
else:
markdown2html = markdown2html_marked