com.vladsch.flexmark.ext.typographic.TypographicExtension Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of flexmark-ext-typographic Show documentation
Show all versions of flexmark-ext-typographic Show documentation
flexmark-java extension for typographic
/*
* Copyright (c) 2015-2016 Vladimir Schneider , all rights reserved.
*
* This code is private property of the copyright holder and cannot be used without
* having obtained a license or prior written permission of the of the copyright holder.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package com.vladsch.flexmark.ext.typographic;
import com.vladsch.flexmark.Extension;
import com.vladsch.flexmark.html.HtmlRenderer;
import com.vladsch.flexmark.parser.Parser;
import com.vladsch.flexmark.util.options.DataKey;
/**
* Extension for typographics
*
* Create it with {@link #create()} and then configure it on the builders
* ({@link com.vladsch.flexmark.parser.Parser.Builder#extensions(Iterable)},
* {@link com.vladsch.flexmark.html.HtmlRenderer.Builder#extensions(Iterable)}).
*
*
* The parsed typographic text is turned into {@link TypographicQuotes} and {@link TypographicSmarts} nodes.
*
*/
public class TypographicExtension implements Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension {
// final public static DataKey TYPOGRAPHICS = new DataKey<>("TYPOGRAPHICS", TypographicRepository::new);
// final public static DataKey TYPOGRAPHICS_KEEP = new DataKey<>("TYPOGRAPHICS_KEEP", KeepType.FIRST); // standard option to allow control over how to handle duplicates
final public static DataKey TYPOGRAPHIC_QUOTES = new DataKey<>("TYPOGRAPHIC_QUOTES", true);
final public static DataKey TYPOGRAPHIC_SMARTS = new DataKey<>("TYPOGRAPHIC_SMARTS", true);
private TypographicExtension() {
}
public static Extension create() {
return new TypographicExtension();
}
@Override
public void extend(Parser.Builder parserBuilder) {
//parserBuilder.postProcessorFactory(new TypographicNodePostProcessor.Factory());
}
@Override
public void extend(HtmlRenderer.Builder rendererBuilder, String rendererType) {
if (rendererType.equals("JIRA")) {
// rendererBuilder.linkResolverFactory(new TypographicLinkResolver.Factory());
//rendererBuilder.nodeRendererFactory(TypographicNodeRenderer::new);
} else if (rendererType.equals("HTML")) {
// rendererBuilder.linkResolverFactory(new TypographicLinkResolver.Factory());
//rendererBuilder.nodeRendererFactory(TypographicNodeRenderer::new);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy