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

New extension: strike through with two tildes #12

Merged
merged 10 commits into from
Apr 3, 2013

Conversation

rekado
Copy link
Contributor

@rekado rekado commented Oct 27, 2012

This patch adds support for strike-through markup as used on github.

Example:

This is ~~good~~ bad.
This is good bad.

@rekado
Copy link
Contributor Author

rekado commented Oct 27, 2012

As this is an extension I could disable this by default and define EXT_STRIKE.

@jgm
Copy link
Owner

jgm commented Oct 27, 2012

Yes, that would be good.

+++ rekado [Oct 26 12 18:38 ]:

As this is an extension I could disable this by default and define
EXT_STRIKE.

--
Reply to this email directly or [1]view it on GitHub.
[xJAuenYDiIoVt3LF3y6848DAslDCyjnQ6q-QyN4VMN9vqr68a8qX6-yXyF69AZxw.gif]

References

  1. New extension: strike through with two tildes #12 (comment)

@rekado
Copy link
Contributor Author

rekado commented Oct 27, 2012

Done. The extension can be enabled with EXT_STRIKE (--strike in the executable).

@jgm
Copy link
Owner

jgm commented Oct 28, 2012

I'm reluctant to merge this yet, as it does not implement output for strikeout in all of the output formats supported...
Could you add support for the other formats?

@rekado
Copy link
Contributor Author

rekado commented Oct 28, 2012

For LaTeX output the ulem package is required. Is print_latex_element_list the right place to put package dependencies?

For groff, a macro needs to be defined; I guess this could be output first with print_groff_mm_element_list before any element is printed. This is the macro as defined here.

.de ST
.nr ww \w'\\$1'
\Z@\v'-.25m'\l'\\n[ww]u'@\\$1
..
.
This is
.ST "a test"
an actual emergency!

It should be easy to add it to the ODF output, so I'm going to do that first.

@rekado
Copy link
Contributor Author

rekado commented Oct 28, 2012

The odf header and footer are added in print_element_list, so I'll add any additional headers for groff and LaTeX there, too.

A groff macro is defined to strike through words enclosed in pairs of
`~~` when rendering to the Postscript device. The macro doesn't yield
suitable results when rendering to any device other than Postscript.

As the macro application requires that the string be placed on its own
line, leading dots have to be escaped that result from splitting strings
like `~~Hello~~. Goodbye` after the last `~~`. Without escaping, the
groff output would be

    .ST "Hello"
    . Goodbye

leading to a failure to process ". Goodbye".
@rekado
Copy link
Contributor Author

rekado commented Nov 1, 2012

I've added strike-through support for groff output when rendering to the Postscript device; it should also work in edge cases.

LaTeX support has also been added.

@rekado
Copy link
Contributor Author

rekado commented Mar 22, 2013

Is there anything else in the way of merging this?

@jgm
Copy link
Owner

jgm commented Mar 25, 2013

Can latex \usepackage commands occur in the document body? I thought they had to be in the preamble, before \begin{document}.

@rekado
Copy link
Contributor Author

rekado commented Mar 28, 2013

Is the output of ./markdown -x --to=latex supposed to be injected into the document section of an existing LaTeX document or is the output supposed to be processed as is? I assumed the latter.

@jgm
Copy link
Owner

jgm commented Mar 28, 2013

No, the former.

+++ rekado [Mar 28 13 06:37 ]:

Is the output of ./markdown -x --to=latex supposed to be injected into
the document section of an existing LaTeX document or is the output
supposed to be processed as is? I assumed the latter.

--
Reply to this email directly or [1]view it on GitHub.
[xJAuenYDiIoVt3LF3y684-0aMJ6ADpiu7R8lfUr7nV1G5WZrj3BkFNOFEFnIYM_Y.gif]

References

  1. New extension: strike through with two tildes #12 (comment)

@rekado
Copy link
Contributor Author

rekado commented Mar 29, 2013

Well, then it's not going to work. I don't know any (non-hackish) way to strike out text in LaTeX without adding this package, and it would have to be added to the preamble.

Do you want me to remove strike-through support for LaTeX then?

@jgm
Copy link
Owner

jgm commented Mar 29, 2013

I don't really have much objection to leaving it in, and
documenting what is needed in the preamble in the README.

+++ rekado [Mar 28 13 20:09 ]:

Well, then it's not going to work. I don't know any (non-hackish) way
to strike out text in LaTeX without adding this package, and it would
have to be added to the preamble.

Do you want me to remove strike-through support for LaTeX then?

--
Reply to this email directly or [1]view it on GitHub.
[xJAuenYDiIoVt3LF3y684-0aMJ6ADpiu7R8lfUr7nV1G5WZrj3BkFNOFEFnIYM_Y.gif]

References

  1. New extension: strike through with two tildes #12 (comment)

The generated LaTeX output is understood to be the document body,
so it may not contain macros that belong into the preamble.
@rekado
Copy link
Contributor Author

rekado commented Mar 29, 2013

I have...

  • updated the code to the latest upstream version
  • removed the \usepackage line from the LaTeX output
  • added instructions to the README (including those relating to the required LaTeX package)

jgm added a commit that referenced this pull request Apr 3, 2013
New extension: strike through with two tildes
@jgm jgm merged commit b6b686c into jgm:master Apr 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants