-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Allow markdown Emph / BulletList characters to be customised (eg. *
vs _
, and -
vs *
)
#10527
Comments
The reason Regarding this issue in general: there are lots of things people might want to tweak in markdown output. Indentation of bullets, character used for bullets, whether lazy wrapping is used, which characters to use for bold or emph, what to use for a horizontal rule, whether to align columns in pipe tables, which table formats to prefer, etc. Adding options to control these would add a lot of additional complexity to pandoc and is probably not worth. See my comments on the very similar issue #10479. |
Ah true, that makes sense. I've never tried to emphasis in the middle of a word, so makes sense why I haven't run into that before.
Oh, I somehow missed that one in my search. Thanks for linking, shall have a read 🖤 For future references, see also:
A random old comment that triggered a path in my brain I hadn't even really thought of to handle this:
I hadn't considered passing But could potentially use another tool to do so (though depending how deep/esoteric we get here.. it may just end up being another 'manipulate markdown AST' type situation.. in which case probably may as well just keep doing it within Looking deeper at the markdown variants:
In the older/deprecated |
Reading further, it seems this could be better resolved with a custom writer rather than the
With an example from Inlines.Emph = function(el)
return concat{ "_", inlines(el.content), "_" }
end Blocks.BulletList = function(el)
local attr = render_attributes(el, true)
local result = {attr, cr}
for i=1,#el.content do
result[#result + 1] = hang(blocks(el.content[i], blankline), 2, concat{"-",space})
end
local sep = blankline
if is_tight_list(el) then
sep = cr
end
return concat(result, sep)
end See also, the following issue about improving the docs: |
Describe your proposed improvement and the problem it solves.
I noticed that the markdown outputs (I was using
gfm
, but it seems to be for most of them) use*
forEmph
output, whereas I was hoping to be able to use_
. I noticed that in plaintext with the gutenberg extension we can render with_
, but that seemingly doesn't work for markdown:pandoc/src/Text/Pandoc/Writers/Markdown/Inline.hs
Lines 376 to 383 in 626ffd7
While it's less directly needed for my particular usecase, I figured it might be useful to be able to configure which character is used when markdown lists are rendered. I noticed that depending on the specific flavour of markdown used it will choose between
*
or-
:pandoc/src/Text/Pandoc/Writers/Markdown.hs
Lines 756 to 770 in 626ffd7
See also:
Describe alternatives you've considered.
I spent the last day or two trying to hack together a
--lua-filter
to handle these cases and make them configurable via--metadata
args. In the end I got a semi-functional PoC script hacked together, but it feels overly complicated and suffers from a number of bugs and edgecases still:The text was updated successfully, but these errors were encountered: