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

list format via enumitem #63

Closed
lululxvi opened this issue May 26, 2020 · 12 comments
Closed

list format via enumitem #63

lululxvi opened this issue May 26, 2020 · 12 comments
Labels
feature request latex Related to the LaTeX interface and implementation lua Related to the Lua interface and implementation question

Comments

@lululxvi
Copy link

lululxvi commented May 26, 2020

I am using enumitem to format my lists: compact and small leftmargin (\setlist{leftmargin=1.25em, nosep}). But this doesn't work for lists defined in markdown. As mentioned in #2, markdown uses paralist compactitem to render lists, is this right? Is it possible to use enumitem for lists defiend in markdown? Thanks.

Another question: how can I use hyperref for links?

@Witiko
Copy link
Owner

Witiko commented May 27, 2020

I am using enumitem to format my lists: compact and small leftmargin (\setlist{leftmargin=1.25em, nosep}). But this doesn't work for lists defined in markdown. As mentioned in #2, markdown uses paralist compactitem to render lists, is this right? Is it possible to use enumitem for lists defiend in markdown? Thanks.

The paralist package is only loaded when the tightLists option is set to true, see also Section 3.3.4 of the technical documentation:

If the \markdownOptionTightLists macro expands to false, do not load the paralist package. This is necessary for LaTeX2ε document classes that do not play nice with paralist, such as beamer. […]

Therefore, the easiest way out for you should be the following:

\markdownSetup{
    tightLists = false,
}

@Witiko
Copy link
Owner

Witiko commented May 27, 2020

Another question: how can I use hyperref for links?

One possible way would using the link renderer:

\markdownSetup{
    renderers = {
        link = {\href{#3}{#1}},
    },
}

@Witiko Witiko added latex Related to the LaTeX interface and implementation question labels May 27, 2020
@lululxvi
Copy link
Author

lululxvi commented May 27, 2020

Thank you. tightLists=false works. I have a few other questions:

  • What grammar of markdown can I use? Is it pandoc? For example, how can I type textsuperscript etc?
  • For the link, my previous question is not clear. For example, in latex after importing hyperref, we can use \url{google.com} to have nice color and clickable link. How can I do this for url in markdown?
  • How can comment in markdown? I found that <!-- --> or pandoc style $-- does not work. Although we can use latex comment grammar %, I prefer pure markdown grammar.
  • I use iftoggle from etoolbox. Even if I use \usepackage[hybrid]{markdown}, the iftoggle doesn't work in markdown. Is it as excepted?

Sorry that I have so many questions, because I like this tool, and want to use it extensively. Thank you in advance.

@Witiko
Copy link
Owner

Witiko commented May 28, 2020

What grammar of markdown can I use? Is it pandoc? For example, how can I type textsuperscript etc?

We support some of the Pandoc's syntax extensions, namely citations and tables. For the full list of supported syntax extensions, see Section 2.2 (Options) of the user manual.

@Witiko
Copy link
Owner

Witiko commented May 28, 2020

For the link, my previous question is not clear. For example, in latex after importing hyperref, we can use \url{google.com} to have nice color and clickable link. How can I do this for url in markdown?

In markdown, there are several ways of producing links:

\documentclass{article}
\usepackage{markdown}
\markdownSetup{
    renderers = {
        link = {\href{#3}{#1}},
    },
}
\usepackage{hyperref}
\begin{document}
\begin{markdown}
This is [an example](http://example.com/ "Title") inline link.

[This link](http://example.net/) has no title attribute.

This is [an example] [id] reference-style link.

[id]: http://example.com/  "Optional Title Here"

This is an automatic link: <http://example.com/>.
\end{markdown}
\end{document}

The result:

links

@Witiko
Copy link
Owner

Witiko commented May 28, 2020

How can comment in markdown? I found that <!-- --> or pandoc style $-- does not work. Although we can use latex comment grammar %, I prefer pure markdown grammar.

You can use the html option:

\usepackage[html]{markdown}
...
\begin{markdown}
This is some text <!-- and this is a comment -->
\end{markdown}

@Witiko
Copy link
Owner

Witiko commented May 28, 2020

I use iftoggle from etoolbox. Even if I use \usepackage[hybrid]{markdown}, the iftoggle doesn't work in markdown. Is it as excepted?

It should not be excepted. Can you give an example document that shows what doesn't work?

@lululxvi
Copy link
Author

Thanks. iftoggle actually works. But html <sup> </sup> or pandoc ^^ doesn't work for text superscript.

@Witiko
Copy link
Owner

Witiko commented May 29, 2020

That's correct. HTML is currently just discarded, not rendered, although there are multiple ways in which we could extend the HTML support in the future:

  1. Support rendering HTML tags such as <sup>.
  2. Support passing HTML through when typesetting HTML documents using make4ht.

Pandoc's extension for superscripts (^^) is currently not supported, but it would be a straightforward addition much like strikeout (~~). I'll make this issue into a feature request and we'll see if I or some other contributor can find the time to implement these.

@Witiko Witiko added feature request lua Related to the Lua interface and implementation latex Related to the LaTeX interface and implementation question and removed latex Related to the LaTeX interface and implementation question labels May 29, 2020
@TomBener
Copy link

For the link, my previous question is not clear. For example, in latex after importing hyperref, we can use \url{google.com} to have nice color and clickable link. How can I do this for url in markdown?

In markdown, there are several ways of producing links:

\documentclass{article}
\usepackage{markdown}
\markdownSetup{
    renderers = {
        link = {\href{#3}{#1}},
    },
}
\usepackage{hyperref}
\begin{document}
\begin{markdown}
This is [an example](http://example.com/ "Title") inline link.

[This link](http://example.net/) has no title attribute.

This is [an example] [id] reference-style link.

[id]: http://example.com/  "Optional Title Here"

This is an automatic link: <http://example.com/>.
\end{markdown}
\end{document}

The result:

links

If the option hybrid = true, the example below with special symbols reported errors:

\documentclass{article}
\usepackage{markdown}
\markdownSetup{
    hybrid = true,
    renderers = {
        link = {\href{#3}{#1}},
    },
}
\usepackage{hyperref}
\begin{document}
\begin{markdown}

A link with special symbols: <http://www.moa.gov.cn/gk/zcfg/nybgz/201111/t20111122_2414394.htm>

\end{markdown}
\end{document}

The errors info was Missing $ inserted., and the log file showed:

[]\TU/lmr/m/n/10 A link with special symbols: http://www.moa.gov.cn/gk/zcfg/nybgz/201111/t20111122$[]\OT1/cmr/m/n/10 414394\OML/cmm/m/it/10 :htm[]$ 
 []

I know a short link can be applied to fix the issue, bu how can I use both the hybrid = true and the original link with special symbols? Thank you!

@Witiko
Copy link
Owner

Witiko commented Nov 10, 2020

@TomBener Hello! Try substituting #3 with #2 in the definition of link. From the documentation (emphasis mine):

The \markdownRendererLink macro represents a hyperlink. It receives four arguments: the label, the fully escaped uri that can be directly typeset, the raw uri that can be used outside typesetting, and the title of the link.

@Witiko Witiko mentioned this issue Aug 8, 2021
8 tasks
@Witiko
Copy link
Owner

Witiko commented Aug 18, 2022

Closed for inactivity.

@Witiko Witiko closed this as completed Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request latex Related to the LaTeX interface and implementation lua Related to the Lua interface and implementation question
Projects
None yet
Development

No branches or pull requests

3 participants