New extension: strike through with two tildes #12

Merged
merged 10 commits into from Apr 3, 2013

Conversation

Projects
None yet
2 participants
Contributor

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.

Contributor

rekado commented Oct 27, 2012

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

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. #12 (comment)
Contributor

rekado commented Oct 27, 2012

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

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?

Contributor

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.

Contributor

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.

rekado added some commits Oct 28, 2012

@rekado rekado Add strike-through support in LaTeX output 2f6a301
@rekado rekado Add strike-through support for groff output
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".
7748eca
Contributor

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.

jgm commented on 7cc5b73 Nov 7, 2012

You might want to rewrite this patch to match the new treatment of Emph and Strong.

Contributor

rekado commented Mar 22, 2013

Is there anything else in the way of merging this?

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}.

Contributor

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.

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. #12 (comment)
Contributor

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?

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. #12 (comment)

rekado added some commits Mar 29, 2013

@rekado rekado Merge branch 'upstream' into strike-extension f4c06b8
@rekado rekado add instructions for strike-through extension 575c375
@rekado rekado Do not print "\usepackage{}" line
The generated LaTeX output is understood to be the document body,
so it may not contain macros that belong into the preamble.
0100362
Contributor

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 jgm added a commit that referenced this pull request Apr 3, 2013

@jgm jgm Merge pull request #12 from rekado/strike-extension
New extension: strike through with two tildes
b6b686c

@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