Question

I'm trying to rewrite some document from latex in org-mode.

What I would like is the code to be highlighted in the exported latex/pdf and html. For latex/pdf I'm using pygments and for html htmlize.el.

I have the following code fragment. If I choose the name "asm", highlighting works for html (htmlize.el) but not for pygments (because it doesn't recognize "asm"). If I change it to "nasm", it works for pygments but not for htmlize.el. How to solve this?

#+begin_src asm
    mov cx,3

    loopstart:
       do stuff
       dec cx
       jnz loopstart
#+end_src 
Was it helpful?

Solution

You can patch the file _mapping.py in ../pygments/lexers/, line 193:

'NasmLexer': ('pygments.lexers.asm', 'NASM', ('nasm','asm'), ('*.asm', '*.ASM'), ('text/x-nasm',)),

('nasm',) becomes ('nasm','asm')

It can help: locate _mapping.py, don't remember to delete the old pyc: sudo rm _mapping.pyc, optionally: sudo python -c "import py_compile;py_compile.compile('_mapping.py')"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top